iframe on Safari: Failed to load resource

南楼画角 提交于 2019-12-13 07:42:38

问题


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>

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

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?


回答1:


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.



来源:https://stackoverflow.com/questions/27605731/iframe-on-safari-failed-to-load-resource

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!