Same Origin Policy Documentation是这样说的:
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";
After that statement executes, the page would pass the origin check with http://company.com/dir/page.html. However, by the same reasoning, company.com could not set document.domain to othercompany.com.
所有流行的浏览器都支持吗?如果不是,哪些不是?
最佳答案
Firefox 2,3, IE6,7,8, Chrome, Safari 2 和 3, Opera 9 都支持 document.domain;
其他“较新”的浏览器也可能会,但是那些是我实际测试过我的代码(使用 document.domain)的浏览器
关于javascript - 设置 document.domain 是否适用于所有(大多数)浏览器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/745831/