Origin policy is the thing?

The so-called same-origin policy, referring to the limit browser access to the different ways the source of the script or text carried out. Js source of such a set can not be read or introducing a source of element attributes b. So first define what is the origin, the so-called homologous refers to two pages have the same protocol, host (also often said domain name), port, three elements are indispensable.

Look at the following comparison becomes clear:

 
Uhrilal URL2 Explanation Whether to allow communication
https://github.com/LoveCatDog/StudyOne https://github.com/LoveCatDog/cms-admin-mall Protocol, the domain name, the same port allow
https://github.com/LoveCatDog/cms-admin-mall https://github.com:8080/LoveCatDog/cms-admin-mall Agreement, the same domain name, different ports Not allowed
http://github.com/LoveCatDog/cms-admin-mall https://github.com/LoveCatDog/cms-admin-mall The same name, the same port, different protocols  Not allowed
https://github.com/LoveCatDog/cms-admin-mall https://cnblogs.com/LoveCatDog/cms-admin-mall
Protocol, same port, different domain name  Not allowed
 https://github.com/LoveCatDog/cms-admin-mall  https://www.github.com/LoveCatDog/cms-admin-mall Protocol, the same port, the same primary domain, different subdomains  Not allowed

 

Interaction between the different sources of the same origin policy restrictions aimed primarily js the XMLHttpRequest and other requests, write code, you also often references js file to other domain names, style files, image files or something, you do not receive these limit

 

Guess you like

Origin www.cnblogs.com/cat-eol/p/11776321.html