flex-iframe error: This content cannot be displayed in a frame

僤鯓⒐⒋嵵緔 提交于 2019-12-13 04:40:00

问题


I have a simple flex application that I created for testing. I download "flex-iframe-1.4.6.zip" library and using this library I am trying to display a url. But it does not show the web page instead it shows an error: "This content cannot be displayed in a frame".

<flexiframe:IFrame id="mapIFrame" visible="true" 
    source="http://www.google.com" width="500" height="500" label="Google"/>

How can I solve this problem?


回答1:


The message "This content cannot be displayed in a frame" is coming from Internet Explorer.

See IE8 Security Part VII: ClickJacking Defenses:

Web developers can send a HTTP response header named X-FRAME-OPTIONS with HTML pages to restrict how the page may be framed. If the X-FRAME-OPTIONS value contains the token DENY, IE8 will prevent the page from rendering if it will be contained within a frame. If the value contains the token SAMEORIGIN, IE will block rendering only if the origin of the top level-browsing-context is different than the origin of the content containing the X-FRAME-OPTIONS directive.

google.com`s current response header contains: X-Frame-Options: SAMEORIGIN

So the answer is: you can't use http://www.google.com in an iframe.

Accordingly, the example in the flex-iframe users guide is outdated (last edit 2 years ago).



来源:https://stackoverflow.com/questions/19542221/flex-iframe-error-this-content-cannot-be-displayed-in-a-frame

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