开发者

Issue with javascript permission denied from iframe, even when it is the same domain

I am having the eternal battle against same origin policy.

I have a registration process loaded dynamically to a page in an iframe. This process is on a different domain which I know is prohibited via the same origin policy.

However ! at the end of the process I direct the frame back to a page on the parent domain with a url variable and then fire a function to refresh the page.

I assumed that as the page is now on the same domain this would not be an issue and on firefox and chrome it works great, however on ie it still throws a permission denied error.

The function im running inside the iframe

if(gup("command") == "ref开发者_开发百科resh"){                
    parent.samRefresh();                
        }

And in the parent frame I have

function samRefresh(){
    location.reload(true);

}

Does any one have any ideas? I know that there are some scripts knocking around to do this however I would prefer not to use them if possible.

Thanks in advance for any help you can give me


Try the following:

In iFrame:

window.parent.success_msg(deferred);

On parent page:

window.success_msg = function(dfd) {
    console.log("I'm from the parent window");
};

Also make sure you're running localhost rather than viewing your files from your file system.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜