我需要更改文档的域,然后将其再次设置回原始值。
它看起来像这样[该页面位于域名base.site.com]:
function execute ()
{
document.domain = "site.com";
// Access an object that is on another frame, but did the same set of the domain
document.domain = "base.site.com";
// Access an object that is on this page (window.createPopup ())
}
问题是这在 IE6 上运行良好(我没有在 7 上测试)。 但当我执行第二个 document.domain 时,它给了我一个错误 [Invalid argument]。
有没有办法在IE8中“重置”文档的域?
最佳答案
问题是,一旦将 document.domain 设置为仅顶级域,就无法将其设置为更严格的值。
来自 MSDN 博客:
Put simply, once you’ve loosened document.domain, you cannot tighten it.
http://blogs.msdn.com/b/ie/archive/2008/09/02/ie8-security-part-vi-beta-2-update.aspx
关于javascript - IE8 Javascript document.domain 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3657710/