当前位置:网站首页>Understanding of cross domain and how to solve cross domain problems
Understanding of cross domain and how to solve cross domain problems
2022-07-04 05:50:00 【Xiao Zhang ii】
If two addresses have the same agreement , Domain name or ip, And the port , Then we will say that these two addresses are from the same source , Browsers have a security policy for addresses of the same origin , That is to prohibit non homologous data operations dom,cookie And receiving ajax, So once there is cross domain , our ajax Cross domain errors will appear when receiving data . There are two solutions to this cross domain error reporting , One is cors Technical solutions , One is jsonp Technical solutions .
cors The solution depends entirely on the back end ( Personally, I am right nodejs There is also some research , Don't say it if you don't learn well ),cors Back end personnel can directly configure , At present commonly used ajax Version pair cors The technical support is very good , We can call the interface directly at the front end , The back end will use this technology to solve cross domain .
and jsonp There's a little bit of trouble , It looks like ajax request , He is a use script A technology of tag sending request , He is front and back , The data returned from the back end to the front end is not simply an object , It's a call to execute a function , Pass the data to be returned as parameters to the parameters of the executing function . Then it requires that the front end must prepare a global callback function to accept this data , When the program is finished , Function will be destroyed ,script Labels will also be destroyed ,jsonp It is compatible with lower version browsers . The disadvantage is that you can only send get request .
边栏推荐
- "In simple language programming competition (basic)" part 1 Introduction to language Chapter 3 branch structure programming
- Supplement the JS of a video website to decrypt the video
- Install pytoch geometric
- BUU-Real-[PHP]XXE
- Review | categories and mechanisms of action of covid-19 neutralizing antibodies and small molecule drugs
- VB.net 简单的处理图片,黑白(类库——7)
- Simulink and Arduino serial port communication
- [microservice] Nacos cluster building and loading file configuration
- Recommended system 1 --- framework
- gslb(global server load balance)技术的一点理解
猜你喜欢
Impact relay jc-7/11/dc110v
Kubernets first meeting
BeanFactoryPostProcessor 与 BeanPostProcessor 相关子类概述
[excel] PivotChart
Zhanrui tankbang | jointly build, cooperate and win-win zhanrui core ecology
BUU-Reverse-easyre
Halcon image calibration enables subsequent image processing to become the same as the template image
Canoe panel learning video
C # character similarity comparison general class
Flask
随机推荐
Nexus 6p从8.0降级6.0+root
云原生架构实战案例及优化解决方案
A little understanding of GSLB (global server load balance) technology
What is MQ?
gslb(global server load balance)技术的一点理解
Qt发布多语言国际化翻译
AWT介绍
JS get the attribute values nested in the object
Recommended system 1 --- framework
left_ and_ right_ Net normal version
Redis realizes ranking function
体验碎周报第 102 期(2022.7.4)
left_ and_ right_ Net interpretable design
left_and_right_net正常版本
Excel 比较日器
Zzulioj:1201: mode problem
VB.net GIF(制作、拆解——优化代码,类库——5)
509. Fibonacci number, all paths of climbing stairs, minimum cost of climbing stairs
buuctf-pwn write-ups (8)
【雕爷学编程】Arduino动手做(105)---压电陶瓷振动模块