2013-10-23 347 views
0

我有一個簡單的Flex應用程序,用於測試。我下載「flex-iframe-1.4.6.zip」庫並使用這個庫,我試圖顯示一個url。但它不顯示網頁,而是顯示錯誤:「此內容無法在框架中顯示」。flex-iframe錯誤:此內容無法在框架中顯示

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

我該如何解決這個問題?

+0

您是否已將參數'wmode =「opaque」'添加到HTML模板中的嵌入中,如[用戶指南]中所述(https://github.com/flex-users/flex-iframe/wiki/Users -指南)? – splash

+0

是的,我將它添加到html模板中。但它並沒有起作用。 –

+0

您使用哪種瀏覽器? – splash

回答

1

消息「此內容無法顯示在框架中」來自Internet Explorer。

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電流響應頭包含:X-框架選項:SAMEORIGIN

因此,答案是:你不能在一個iframe使用http://www.google.com

因此,flex-iframe users guide中的示例已過時(上次編輯2年前)。

+0

當我使用Firefox時,它不顯示此消息。其實它不顯示任何東西,頁面保持空白。與鉻和safari一樣。 –

+1

@SarfrazAhmed所有現代瀏覽器都會考慮X-Frame-Options響應標題。消息「此內容不能在框架中顯示」是IE特定的。其他瀏覽器如Firefox可能不會顯示消息,但只是一個空白的iframe。 – splash

相關問題