In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
Editor to share with you what cross-domain methods based on browser homology strategy, I believe most people do not know much about it, so share this article for your reference, I hope you will learn a lot after reading this article. Let's take a look at it!
Flash cross-domain
This is an old cross-domain approach, which is basically not used now. If you are interested, you can see it for yourself, and we will not discuss it here.
Server transfer agent
Since the same origin policy is only limited by the browser, the server will not be restricted by the same origin policy, so when we can send requests, we can set up a proxy server, which is homologous to our current url. First, the request is made to the same origin server, and then the same origin server is redirected to the url we want to access, because the server and the server are not restricted by the same origin policy before. So you can have unrestricted access even if you are not of the same origin.
It is also a common way for us to transfer servers to agents.
JsonP is cross-domain.
JsonP cross-domain is a cross-domain approach that we often use. We all have the experience of using the src attribute in script to introduce external resources, such as jQuery. If you pay a little attention to the following, you can see that the requested url is actually different from our local url, but why can we request resources? This is because the src property has cross-domain capabilities. All tags that have the attribute src have cross-domain capabilities, and they are all GET requests such as,
、
Usage
Because we cannot monitor whether the passed src property has finished fetching the data, we need to do a process. Usually, when we pass parameters to the backend, we pass a function that handles cross-domain data acquisition, and the server will return the corresponding content according to the value of the parameter cb.
Function doJSON (data) {} var scri = document.createElement ('script') scri.src =' http://xxx' +'? cd ='+ doJSON
In this way, the data returned to us by the background is like this: doJSON (data), so that the method we defined will automatically execute in our page, and the parameters of the method are the data we want, so we can deal with the relevant business logic in this method.
Document.domain
We can set documentl.domain on the page, but this is only for cases where the underlying domain name is the same. For example, if you set document.domain = '58.compose in bj.58.com and tj.58.com, you can access these two pages as long as the basic domain name is 58.com
The above is all the contents of the article "what are the cross-domain ways based on browser homology strategy"? thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.