What is a homologous strategy?
The same-origin policy is a complete security restriction on JavaScript code that can manipulate those web content. This strategy can work when a Web page uses multiple IFRAME elements or opens multiple forms.
Understand the same origin policy: script source and document source.
Script source:<script> javascript src= "http (s)://..." Source.
Document Source: Contains: protocol, host, and URL port number of the loaded document. Documents that are loaded from different Web servers have different sources.
It is important to understand these two points.
Document Source: 1. Documents loaded from different ports on the same host have different sources.
2. Loading documents on the same server via HTTP and HTTPS has different sources.
3, above three points can not be the same.
Script Source: 1, the script from host A is included in the <script> of Host B in the web, the source of this script is B,
2, the script opens a new form, loads the document of Host B, the script has full access rights.
3, the script opens a new form, loads the document of host C, the same-origin policy will prevent the script from accessing this document.
The same-origin strategy adapts to almost all JavaScript object properties.
? 1 The same-origin policy can cause problems for large sites with multiple subdomains.
1. Load the documents under other subdomains. Document hierarchy change domain, for example: home.example.com, domain can be set to: example.com, can.
Set the script for another document to be accessed to the same domain.
2. Cross-domain resource sharing (cross-origin Resource sharing), see: Cross-domain resources
3. Cross-document messages (Cross-document messing).
Code: You crossing, I understand and then write ...
JavaScript homology policy