当前位置:网站首页>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
边栏推荐
- Thinking (87): Protocol encryption and compression
- 6、STM32——串口数据收发基础
- Stm32 - - - - interruption externe
- CTF—Go题目复现
- 2018/GAN:Self-Attention Generative Adversarial Networks自我注意生成对抗网络
- 【HackTheBox】 meow
- PyQt5_QTableWidget分页单选右键菜单控件
- 泰勒公式及常用展开
- What kind of automated test is used for H5 mobile terminal
- 6月25日PMP考试敏捷怎么考?替你分忧解难
猜你喜欢

高仿書旗小說 Flutter 版,學起來

"Shanda Diwei Cup" the 12th Shandong ICPC undergraduate program design competition

微信录制视频转圈效果如何实现?

图论(树的直径)

生成式对抗网络(GANs)及变体

HDLBits-> Circuits-> Arithmetic Circuitd-> 3-bit binary adder

【HackTheBox】 meow

CTF go topic recurrence

再见,2020,这碗毒鸡汤,我先干了

What is the production process of enterprise website? How long does it take to design and build a website?
随机推荐
High imitation Book flag novel flutter edition, learn it
iNFTnews | 创造者经济的未来在Web3世界中该去向何处?
STM32 ------ external interrupt
Kotlin 协程 异步 异步流
【HackTheBox】Fawn
AUTOCAD——总结CAD画圆角的三种方式
E: Unable to acquire lock /var/lib/dpkg/lock
Why do MySQL indexes use b+ trees at the bottom? After reading this article, you can easily handle the interview.
Develop synergy and efficiently manage | community essay solicitation
A cartoon reading app highly imitating Tencent comics
Stm32 - - - - interruption externe
7、STM32——LCD
To ensure the safety of groups with special difficulties, Guangzhou Civil Affairs made every effort to do a good job in the three prevention work
推荐4个Flutter重磅开源项目
ARouter 组件之间跳转需免混淆
项目中常用到的 19 条 MySQL 优化
一款高仿腾讯漫画的漫画阅读类 APP
Simple understanding of responsive programming
ORB_SLAM3环境搭建及demo演示
2018/GAN:Self-Attention Generative Adversarial Networks自我注意生成对抗网络