当前位置:网站首页>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 .
边栏推荐
- Gridview出现滚动条,组件冲突,如何解决
- Invalid revision: 3.18.1-g262b901-dirty
- Signification des lettres du module optique et abréviation des paramètres Daquan
- 接地继电器DD-1/60
- 总线的基本概念
- BUU-Real-[PHP]XXE
- (4) Canal multi instance use
- One click filtering to select Baidu online disk files
- My NVIDIA developer journey - optimizing graphics card performance
- How to expand all collapse panels
猜你喜欢
70000 words of detailed explanation of the whole process of pad openvino [CPU] - from environment configuration to model deployment
Compound nonlinear feedback control (2)
Actual cases and optimization solutions of cloud native architecture
win10清除快速访问-不留下痕迹
Input displays the currently selected picture
[QT] create mycombobox click event
光模塊字母含義及參數簡稱大全
1480. Dynamic sum of one-dimensional array
体验碎周报第 102 期(2022.7.4)
Principle and practice of common defects in RSA encryption application
随机推荐
卸载Google Drive 硬盘-必须退出程序才能卸载
1.1 history of Statistics
My NVIDIA developer journey - optimizing graphics card performance
19.Frambuffer应用编程
Build an Internet of things infrared temperature measuring punch in machine with esp32 / rush to work after the Spring Festival? Baa, no matter how hard you work, you must take your temperature first
报错cvc-complex-type.2.4.a: 发现了以元素 ‘base-extension‘ 开头的无效内容。应以 ‘{layoutlib}‘ 之一开头。
[QT] create mycombobox click event
[excel] PivotChart
检漏继电器JY82-2P
1480. Dynamic sum of one-dimensional array
谷歌 Chrome 浏览器将支持选取文字翻译功能
Design and implementation of redis 7.0 multi part AOF
ansys命令
【雕爷学编程】Arduino动手做(105)---压电陶瓷振动模块
Configure cross compilation tool chain and environment variables
Canoe panel learning video
What is MQ?
每周小结(*63):关于正能量
left_ and_ right_ Net interpretable design
JS flattened array of number shape structure