Javascript 访问控制请求头: - x-requested-with

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2746954/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-23 01:44:32  来源:igfitidea点击:

Access-Control-Request-Header: - x-requested-with

javascripthttpcross-domaincorsaccess-control

提问by Tom

I am building a widget for my users and trying to get it working however I keep running into a X-Domain issue with this header. httpfox gives me - NS_ERROR_DOM_BAD_URI - and on further investigation I find that its

我正在为我的用户构建一个小部件并试图让它工作,但是我一直遇到这个标题的 X-Domain 问题。httpfox 给了我 - NS_ERROR_DOM_BAD_URI - 在进一步调查中我发现它

Access-Control-Request-Method:  GET
Access-Control-Request-Header:  x-requested-with

I am not sure why its not loading but I basically call a script and then I am trying to grab some html to load it but it gets blocked with the above headers.

我不确定为什么它没有加载,但我基本上调用了一个脚本,然后我试图获取一些 html 来加载它,但它被上述标题阻止了。

How can I get around this prob ?

我怎样才能解决这个问题?

回答by Tom

OK - think I found the answer. See generally

好的 - 我想我找到了答案。一般见

http://saltybeagle.com/2009/09/cross-origin-resource-sharing-demo/

http://saltybeagle.com/2009/09/cross-origin-resource-sharing-demo/

seems to provide a way around it

似乎提供了一种解决方法