IE8 Javascript的document.domain错误 [英] IE8 Javascript document.domain error

查看:158
本文介绍了IE8 Javascript的document.domain错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要更改文档的域,然后将其重新设置为原始值。

I need to change the domain of the document and then set it back again to the original value.

它看起来像这样[该页面在域基础上.site.com]:

It looks something like this [the page is on domain 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时,它给我一个错误[无效的参数]。

The problem is that this works fine on IE6 (I did not test on 7). But it gives me an error [Invalid argument] when i execute the second document.domain.

有没有办法重置文档在IE8?

Is there any way to "reset" the domain of the document in IE8?

推荐答案

问题是您无法将document.domain设置为更严格的价值,一旦您将其设置为top-

The problem is you cannot set document.domain to a more strict value once you set it to top-domain only.

从MSDN博客中:


简单地说,一旦你我们松开了document.domain,你不能收紧。

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

这篇关于IE8 Javascript的document.domain错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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