简体   繁体   中英

3 ways to make a cross-domain request in Javascript

I already know 2 ways (proxy using php and including an external javascript file). What is another way?

You can use Access-Control-Allow-Origin: * in the headers coming from the server on the other domain.

That relies on the browser being modern, however. Won't work on IE older than 8.

See https://developer.mozilla.org/En/HTTP_access_control

There is also Cross-Document Messaging combined with regular XHR.

An example of this can be seen on the easyXDM example page: http://consumer.easyxdm.net/current/example/xhr.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM