Safari上的iframe:无法加载资源 [英] iframe on Safari: Failed to load resource

查看:1645
本文介绍了Safari上的iframe:无法加载资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用iframe如下:

I use iframe as below:

<iframe src="http://www.expedia.com/Hotel-Search?#&destination=Abbotsford,%20British%20Columbia,%20Canada&startDate=12/29/2014&endDate=1/3/2015&adults=2" frameborder="0" width="900px" height="900px"></iframe>

它在Chrome和Firefox上运行良好,甚至IE。但在Safari上,它是失败的,我打开日志,并看到:

It runs well on chrome and firefox, even IE. But on safari, it's fail, I open log and see:

[Error] Failed to load resource: the server responded with a status of 400 (Bad Request) (Hotel-Search, line 0)   http://www.expedia.com/Hotel-Search?inpAjax=true&responsive=true

但是当我直接在新选项卡中访问该URL时,在返回到iframe页面和刷新页面之后,它运行正常,没有错误。如果我清除历史记录并刷新页面,iframe将再次出错。原因是什么?你可以给任何解决方案吗?

But when I access that URL directly in new tab, after that comeback to iframe page and refresh page, it runs normal without errors. If I clear history and refresh page, the iframe will be error again. What is the cause? and could you give any solution?

推荐答案

简单地说,当您复制并粘贴链接到另一个选项卡中的链接并加载expedia页面将开始与Expedia的会话并将其设置在您的浏览器中......然后,由于您已与Expedia开始会话,因此您现在可以与Expedia进行会话。所以如果你没有去过这个网站来获得一个会话,那么Safari和IE上的iframe将无法工作。他们阻止它的原因是为了防止可能构成安全风险的跨站脚本攻击。

In simple terms when you copy and paste the link in the url in another tab and load the expedia page it will start your session with Expedia and set it in your browser... Then since you have started a session with Expedia the iframe will work because you now have a session with Expedia. So if you haven't gone to the site first to get a session the iframe on Safari and IE won't work. The reason they block it is to protect against cross-site scripting attacks which could pose a security risk.

这篇关于Safari上的iframe:无法加载资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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