Changing document.domain to completely other domain

后端 未结 1 1979
旧巷少年郎
旧巷少年郎 2020-12-11 09:36

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 t

相关标签:
1条回答
  • 2020-12-11 09:44

    Check out : developer.mozilla.org/same-origin-policy

    Here is an excerpt from the site:

    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.

    0 讨论(0)
提交回复
热议问题