本地主机中的IE跨域Ajax请求 [英] IE cross-domain ajax request in localhost

查看:193
本文介绍了本地主机中的IE跨域Ajax请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一台运行在本地主机端口3002上的服务器,当我尝试从本地主机端口3000发送ajax请求时,该请求未在任何版本的Internet Explorer中发送.(在chrome和firefox中可以正常工作).我也尝试过使用jquery插件jquery.xdomainajax.js,而且我也有

I have a server running in localhost port 3002 and when i try to send an ajax request from localhost port 3000, the request is not sent in any version of Internet explorer.(Works fine in chrome and firefox). I have also tried using jquery plugin jquery.xdomainajax.js and also i have

def set_access_control_headers headers ['Access-Control-Allow-Origin'] ='' headers ['Access-Control-Request-Method'] ='' 结束

def set_access_control_headers headers['Access-Control-Allow-Origin'] = '' headers['Access-Control-Request-Method'] = '' end

应用程序控制器中在本地主机端口3002中运行的服务器的代码中的方法.

method in application controller in code of server running in localhost port 3002.

我的要求:在IE中跨域发送ajax请求并处理响应. 任何帮助都将得到高度重视.

My requirement: Send an ajax request cross-domain in IE and handle the response. Any help would be highly appriciated.

预先感谢

推荐答案

在某些版本中,默认情况下,IE禁止跨域访问数据源:

IE disables access to data sources across domains by default in some versions: http://msdn.microsoft.com/en-us/library/ms537505(v=vs.85).aspx#xdomain

在"Internet选项"中,转到安全性",然后单击自定义级别..."按钮.该设置在其他"部分的列表底部附近:跨域访问数据源"

In Internet Options, go to Security and click on the "Custom Level..." button. The setting is near the bottom of the list in the Miscellaneous section: "Access data sources across domains"

在Intranet环境中遇到此问题之前,我可以禁用该设置并通过组策略将其推送给用户,但是我确定对于Internet应用程序,您希望找到一个更好的解决方法.

Before I have run into this in an intranet environment where I can disable the setting and push to users via group policy, but I'm sure for an internet app you'd want to find a better workaround.

这篇关于本地主机中的IE跨域Ajax请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆