ASP.NET跨域模态窗口(window.showModalDialog) - 总是参数值与QUOT;不确定" [英] ASP.NET cross domain modal window (window.showModalDialog) - parameter value always "undefined"

查看:213
本文介绍了ASP.NET跨域模态窗口(window.showModalDialog) - 总是参数值与QUOT;不确定"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个网页,父页面的.aspx和子页面的.html。
在父页面我有JavaScript函数通过调用window.showModalDialog子页面模式窗口。

I have two webpages, parent page .aspx and child page .html. On parent page I have JavaScript function for invoking child page as modal window via window.showModalDialog.

function viewCourseModal(url) {

var sPars = SomeParameters();
var returnedValue = window.showModalDialog(url, "", sPars);
document.getElementById("modalReadyForTest").value = returnedValue;  

return returnedValue;

}

在子页面我有以下几点:

On the child page I have the following:

<script LANGUAGE="JavaScript">

function closewindow() {
    window.returnValue = "someValue";
    window.close();
}

<input id="Button1" type="button" value="Ready For Test" onclick="closewindow()" />

所以,当我启动父窗口并在点击按钮调用子模式窗口,参以someValue中被返回给父窗口(以modalReadyForTest控制)Button1的。

So when I launch parent window and invoke child modal window, parameter with "someValue" gets returned to the parent window (to modalReadyForTest control) upon clicking the button Button1.

当我在同一个域上的父母和孩子的页面,它工作正常。当我让他们在不同的领域,参数的值不会获得通过,而是它始终是不确定。

It works fine when I have both parent and child pages on the same domain. When I have them on different domains, value of the parameters does not get passed and instead it is always "undefined".

有什么办法有不同域的参数值返回到父页面模式窗口?可以将这些跨域问题都得到解决,或者我应该尝试完全不同的方法?

Is there any way to have modal window from different domain returning parameter value to parent page? Can those cross domain issues be solved at all or should I try completely different approach?

我会强烈AP preciate任何帮助。

I would highly appreciate any assistance.

谢谢,安瓦尔

推荐答案

父页:

<script>
function test(str) {
    alert(str);
}
</script>

子页面:

<input id="Button1" type="button" value="Ready For Test" onclick="opener.test('my value here')" />

这篇关于ASP.NET跨域模态窗口(window.showModalDialog) - 总是参数值与QUOT;不确定&QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆