我有这个 swf 文件,它会请求一个 crossdomain.xml
播放前的文件。并且文件主机配置为禁止“盗链”(即服务器会检查Referer Header,如果referer不在列表中则返回302
)。
在 chrome 中一切正常,但对 crossdomain.xml
的请求文件不会发送 Referer
IE 中的标题,因此无法获取文件。
我已经在 IE 11 的调试工具中测试了 IE 11、IE 8 和 IE 9、10。
我不是这个 swf 文件的作者,也不知道它是如何工作的。有什么解决办法吗?谢谢!
更新:
我没有得到答复,所以我必须重新配置服务器以禁用 302 重写。
最佳答案
根据 IE 文档:
When linking from one document to another in Internet Explorer 4.0 and later, the Referer header will not be sent when the link is from an HTTPS page to a non-HTTPS page. The Referer header also will not be sent when the link is from a non-HTTP(S) protocol, such as file://, to another page.
您可以阅读更多信息 here
您可以尝试模仿类似的东西来覆盖该行为:
//use browser sniffing to determine if IE or Opera (ugly, but required)
var isOpera, isIE = false;
if(typeof(window.opera) != 'undefined'){isOpera = true;}
if(!isOpera && navigator.userAgent.indexOf('Internet Explorer')){isIE = true;}
//define for all browsers
function goto(url){
location.href = url;
}
//re-define for IE
if(isIE){
function goto(url){
var referLink = document.createElement('a');
referLink.href = url;
document.body.appendChild(referLink);
referLink.click();
}
}
更多信息 here
关于Flash 播放器在 GET 文件时不会发送 Referer Header,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20804511/