当前位置:网站首页>What is the same origin policy?
What is the same origin policy?
2022-06-23 23:45:00 【Learn-anything. cn】
One 、 What is the homology strategy ?
One URL There are three parts : agreement 、 domain name ( Point to host )、 port , Only these three are exactly the same URL Can be called homology . as follows , Energy and harmony http://www.example.com/dir/index.html Homologous is ?
| URL | result | reason | | ---------------------------------------- | ------ | ---------------------------------- | | `http://www.example.com/dir2/other.html` | Homology | Only the path is different | | `https://www.example.com/secure.html` | Different sources | Different agreements | | `http://www.example.com:81/dir/etc.html` | Different sources | Different ports ( `http://` The default port is 80) | | `http://news.example.com/dir/other.html` | Different sources | Domain name is different |
Two 、 Parent domain name and child domain name
Can be set by document.domain, Let the child domain name and the parent domain name pass the detection of homology policy .
// 1、 The page below the subdomain name
http://store.company.com/dir/other.html
// 2、 Modify... In script code
document.domain = "company.com";
// 3、 Then go to the page under the parent domain name , Can not be intercepted across domains
fetch("http://company.com/dir/page.html") remarks : But if the port is not the default 80, It will also fail , because document.domain = "company.com"; Will set the port to null
3、 ... and 、 Cross domain access
The solution for cross domain access is CORS, details , Look here !
Four 、window.postMessage( Not recommended )
Cross domain access can also be through window.postMessage To achieve , But I don't recommend it , It can easily cause security problems .window.postMessage - Detailed instructions !
5、 ... and 、 Reference documents
边栏推荐
- Acrel-3000WEB电能管理系统在都巴高速的应用
- ACM. HJ89 24点运算 ●●●
- STM32------ADC(电压检测)
- ORB_SLAM3环境搭建及demo演示
- The digital transformation index report 2021 released by Tencent Research Institute has accelerated the digital transformation and upgrading of mainland enterprises!
- Nlog详解
- Stm32----- timer
- 2022 point de connaissance de l'examen des ingénieurs en sécurité de l'information: contrôle d'accès
- 接私活必备的 6 个开源项目
- Some explanations of Tim timer of embedded interface and STM32 template library function of NVIC
猜你喜欢
随机推荐
Some explanations of Tim timer of embedded interface and STM32 template library function of NVIC
Inftnews | where should the future of the creator economy go in the Web3 world?
Is the geTx status management in the flutter really so good to use?
不同物体使用同一材质,有不同的表现
AutoCAD -- summarize three methods of drawing rounded corners in CAD
Stm32----- timer
有哪些劵商推荐?在线开户安全么?
高仿斗鱼 APP
Embedded interface review materials
Activity的onSaveInstanceState回调时机
log Network Execution Time
图论(树的直径)
Onsaveinstancestate callback opportunity of activity
VS QT VTK 左下角显示同步小坐标轴
Golang 类型断言
思考(八十七):协议加密与压缩
嵌入式接口复习资料
AUTOCAD——总结CAD画圆角的三种方式
6月25日PMP考试敏捷怎么考?替你分忧解难
Solve the problem that slf4j logs are not printed









