3种使用Javascript创建跨网域请求的方法 [英] 3 ways to make a cross-domain request in Javascript
本文介绍了3种使用Javascript创建跨网域请求的方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经知道2种方式(使用php和包括外部javascript文件的代理)。
I already know 2 ways (proxy using php and including an external javascript file). What is another way?
推荐答案
您可以在标题中使用Access-Control-Allow-Origin:*
从其他域的服务器。
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.
请参阅 https://developer.mozilla.org/En/HTTP_access_control
这篇关于3种使用Javascript创建跨网域请求的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文