将document.domain更改为完全其他域 [英] Changing document.domain to completely other domain

查看:228
本文介绍了将document.domain更改为完全其他域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试证明更改document.domain只能用于同一上层域的交叉脚本。例如,如果我将尝试将document.domain更改为位于www.test.com页面上的google.com,我将在FF中获得安全例外。有谁知道在哪里找到官方证明?

I'm trying to prove that changing document.domain can be used only for cross scripting on the same upper level domain. For example if i will try to change document.domain to "google.com" on page which is located on www.test.com I will get a security exception in FF. Does anybody know where to locate an official proof of that?

推荐答案

退房: developer.mozilla.org/same-origin-policy

以下摘录自网站:


同一
来源规则有一个例外。脚本可以将document.domain的
值设置为当前域的后缀
。如果它这样做,
较短的域用于
后续原产地检查。例如,
假定文档中的脚本为
http:// store .company.com / dir / other.html
执行以下语句:

There is one exception to the same origin rule. A script can set the value of document.domain to a suffix of the current domain. If it does so, the shorter domain is used for subsequent origin checks. For example, assume a script in the document at http://store.company.com/dir/other.html executes the following statement:

document.domain =company.com;

document.domain = "company.com";


语句执行之后,页面
将使用
传递原点检查 http://company.com/dir/page.html
但是,出于同样的原因,
company.com无法将
document.domain设置为othercompany.com。

这篇关于将document.domain更改为完全其他域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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