在客户端,我有:
<script src="js/plugins/xdomain.min.js" slave="https://api/proxy.html"></script>
然后在服务器上,我有一个 proxy.html:
<!DOCTYPE HTML>
<script src="js/xdomain.min.js"></script>
<script>
xdomain.masters({
"https://*.localhost" : '/.*/',
"https://*.host.net" : '/.*/'
});
</script>
在 IE9 的开发工具中,我有 xdomain 日志记录:
'proxying request to slave:'
'new socket:'
'Timeout waiting on iframe socket'
我没有看到任何数据传递给客户端 - 即我的 Controller 中的模型是空的。
最佳答案
您应该在浏览器中打开您的 proxy.html 并查看它是否正在发送“X-Frame-Options” header ,如果是,这将阻止 IE9 在 iFrame 中打开页面。您必须关闭 proxy.html 的“X-Frame-Options” header ,然后它才能正常工作。
关于javascript - 我在客户端和服务器端都实现了 xdomain 脚本,但在 IE9 中不断收到 'Timeout waiting on iframe socket' 警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23619734/