询问者
IE8 document.domain 问题,如果域名短的话 会出错, 比如设置 document.domain='x.cn'

常规讨论
全部回复
-
IE8你试试sDomain
我的博客,最近新写了一个Windows Mobile 6.5 Widget开发的文章,欢迎捧场
尽力回答每一个问题,但不代表一定正确,希望初学者能够多自己尝试。。共勉。。:) -
-
上面的文章里提到:
"his property cannot be used to enable cross-frame communication among frames with different domain suffixes. For example, a page in one frame from www.microsoft.com and a page in another frame from www.msn.com cannot communicate with each other, even if the domain property of both pages is set to the suffix "microsoft.com." "
也就是说 域名后缀 如果不同,是会出错的。
另外,如果可以随便设置domain 属性,而且这个属性是可以在客户端修改,这也给跨站攻击(cross site scripting) 提供了可能性。请看下面这篇文章:
http://msdn.microsoft.com/en-us/library/ms533047(VS.85).aspx
IE8 出于安全考虑 默认禁止了 对document.domain 属性的任意设置。
Microsoft Online Community Support -
上面的文章里提到:
您可能没明白我的问题呢
"his property cannot be used to enable cross-frame communication among frames with different domain suffixes. For example, a page in one frame from www.microsoft.com and a page in another frame from www.msn.com cannot communicate with each other, even if the domain property of both pages is set to the suffix "microsoft.com." "
也就是说 域名后缀 如果不同,是会出错的。
另外,如果可以随便设置domain 属性,而且这个属性是可以在客户端修改,这也给跨站攻击(cross site scripting) 提供了可能性。请看下面这篇文章:
http://msdn.microsoft.com/en-us/library/ms533047(VS.85).aspx
IE8 出于安全考虑 默认禁止了 对document.domain 属性的任意设置。
Microsoft Online Community Support
我的意思是,比如说:我的域名是 www.h.cn 我现在建了个二级域名 blog.h.cn 现在我要 blog.h.cn和 www.h.cn 通信, 就需要设置 document.domain = 'h.cn'; 但在IE8会报“无效参数错误”,而且无法访问www.h.cn的页面 IE6,7,ff都没有问题 。