Workarounds for JS + XMLHTTP cross-origin website Data Reading

Source: Internet
Author: User

When JS + XMLHTTP accesses data from other websites across sites, it will face the problem of cross-origin access data. The core reason for this restriction is not the server, but the IE of the customer segment, which is restricted by security considerations. Therefore, this cross-origin access restriction can only be concentrated on breaking through the IE restriction, the stupid way is to directly set ieto allow cross-origin in the security settings of IE, so that the client segment script can be accessed across-origin, however, the biggest disadvantage of this method is that the customer needs to adjust it manually. Because the default setting of IE is disabled, this path is obviously unavailable. Therefore, we can only adopt other workarounds. First, cross-origin access is restricted by the client, that is, Internet Explorer. However, cross-origin access through server scripts is allowed on the server, in this way, we can use the server segment scripting technology in the local domain, that is, our own domain name. First, we can obtain data from another domain, and then the client will read the local intermediate interface, to achieve cross-origin access.

JS + XMLHTTP ------> Cross-origin interface (restricted by customer segments)

The alternative access is

JS + XMLHTTP -----> local region interface (ASP or PHP/JSP/Asp.net, etc.) ----- cross-origin interface note: that is to say, first obtain data from other domains through the server segment script technology locally, and then call this interface in the local region.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.