为什么我的window.dialogArguments未定义 [英] why is my window.dialogArguments undefined

查看:1248
本文介绍了为什么我的window.dialogArguments未定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在模式对话框中打开.aspx页.这是我用来打开对话框的JS代码:

I need to open up a .aspx page in a modal dialog. Here is the JS code I use to open the dialog:

        if (url) {
            var fullPath = url + "/Validation.aspx";
        }
        else {
            alert("Could not find the location of the merge dialog.  Please contact your System admin and have them update the configuration entity.");
            return;
        }

        var features = "unadorned:yes;scroll:yes;resizable:yes;status:yes;dialogHeight:480px;dialogWidth:480px;";

        var args = {
            selected: selectedIds,
            page: pageIds,
            fetchXml: xml,
            entity: "xyz"
        };

        window.showModalDialog(fullPath, args, features);

在我的validate.aspx页面中,我需要能够获取JS参数,将其分配给隐藏字段,然后重新发布,以便可以在服务器端使用这些arg值.

In my validation.aspx page I need to be able to grab the JS arguments, assign them to hidden fields, then repost, so I can use those arg values server side.

这是我的.aspx页面中的JS代码:

here is my JS code in my .aspx page:

window.onload = function(){        
    if (!window.dialogArguments)
        return;

        var args = window.dialogArguments;
        ...
}

我在网络上看到了无数的例子. 但是...我的.aspx页中的window.dialogArguments始终是未定义的.是什么赋予了?任何人有任何想法或解决方案吗?

I have seen tons of examples of this working throughout the web. But...My window.dialogArguments is always undefined in my .aspx page. What gives? anyone have any thoughts or solutions?

推荐答案

我在这里的假设是ASPX对话框页面是跨域打开的.

My assumption here is that the ASPX dialog page is being opened cross-domain.

这意味着您的父页面位于另一个域中,即http://abc/page.html,而您的子对话框页面位于另一个域中,例如:http://def/dialog.html.

This would mean that your parent page is in one domain aka: http://abc/page.html, and that your child dialog page is in another domain like: http://def/dialog.html.

在这种情况下,似乎对访问dialogArguments和returnValue有限制.在此先前的答案中查看评论例如.

If this is the case, it seems as though there are restrictions against accessing dialogArguments and returnValue. Check out the comments on this previous answer for example.

这篇关于为什么我的window.dialogArguments未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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