为什么我的window.dialogArguments未定义(why is my window.di

2019-09-30 05:08发布

我需要在一个模式对话框打开一个.aspx页。 下面是我用它来打开对话框的JS代码:

        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);

在我validation.aspx页,我需要能够抓住的JS参数,它们分配给隐藏字段,然后重新发布,这样我就可以使用这些ARG值服务器端。

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

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

        var args = window.dialogArguments;
        ...
}

我看到吨这个工作的例子在整个网络。 但是...我window.dialogArguments在我的.aspx页面中总是不确定的。 是什么赋予了? 任何人有任何想法或解决方案?

Answer 1:

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

这意味着,你的父页面是一个又名域名: http://abc/page.html ,和你的孩子对话页面是像另一个领域: http://def/dialog.html

如果是这样的话,它好像有对访问dialogArguments和ReturnValue限制。 看看上的评论此以前的答案的例子。



文章来源: why is my window.dialogArguments undefined