javascript - IE8 Javascript document.domain 错误

标签 javascript internet-explorer-8 dns

我需要更改文档的域,然后将其再次设置回原始值。

它看起来像这样[该页面位于域名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/

相关文章:

linux - DNS 服务器在 QEMU 用户模式网络中不工作

javascript - 隐藏 Electron alteast 1 文件的源代码。可能吗?

javascript - Google Maps Geocoding API,其 JS api 中缺少 API 的功能(?)

python - 扭曲。 dns 回复中超过 1 个 IP 地址

css - 背景属性在 IE 中不显示

css - @font-face 仿粗体 ie7-ie8

c++ - 如何使用 c-ares 将 IP 解析为主机?

javascript - 何时使用 jQuery.ajax,何时使用 jQuery.post?

javascript - Firebase数据库重写数据

css - 打印机友好页面不适用于 IE8