可以在IE中从https到http发出跨域请求吗?
我们正在尝试从浏览器访问本地自托管WCF服务.
WCF服务位于 http://localhost/myWcf
.
浏览器正在运行一个位于 https://some.www.com
的网站.
We are trying to access a local self-hosted WCF service from the browser.
The WCF service is located at http://localhost/myWcf
.
The browser is running a website which is located at https://some.www.com
.
我们已启用CORS,并将CORS标头添加到托管的WCF.使用jQuery的$ .ajax调用即可访问WCF服务.在不使用SSL的情况下,所有浏览器都可以正常运行,我们将进入成功"回调.
切换到SSL时,IE是唯一无法发出请求的请求-拒绝访问".我们将网站移至受信任的站点"部分,基本上允许那里的一切,但仍然无法进行.我们正在使用IE11/10,并且已经通过其模拟器尝试了以前的版本.他们中没有一个允许我们提出该请求.
We have enabled CORS and added CORS header to the hosted WCF. Access to the WCF service is done using jQuery’s $.ajax call. All browsers are working fine when not using SSL and we’re getting to the "success" callback.
When switching to SSL, IE is the only one that fails to make the request – "Access is denied". We moved the website to the trusted sites section and basically allowed everything there and still no go. We’re using IE11/10 and we've tried previous versions through its emulator. None of them allows us to make that request.
我们可以像这样通过https处理位于http中的图片:
<img src="http://asdasd">
但是我们尝试使用javascript失败:
but we try to use javascript it fails:
var img = new Image();
img.src="http://asdasd";
我们缺少什么?在IE中从https到http发出跨域请求真的是不可能的吗?
What are we missing? Is it really impossible to make a cross domain request from https to http in IE?
检查jsonp:
var script = document.createElement('script');
script.id = 'dynScript';
script.type='text/javascript';
script.src = 'http://localhost/myWcf';
document.getElementsByTagName('head')[0].appendChild(script);
JSONP可以很好地解决跨域脚本错误.
JSONP is a great away to get around cross-domain scripting errors.