[英]Inserting HTML to iframe works in Firefox/Chrome/Opera but not in IE7/8
[英]Problems with styling HTML page in an iframe (in Chrome and IE)
我正在將HTML文件加載到iframe
,並且它具有鏈接的CSS文件*。 這在Mozilla中可以按預期工作,但在完全不使用CSS的IE和Chrome中卻無法實現。 我怎樣才能解決這個問題?
*使用Microsoft Excel生成
<div id="reportholder" style="width:100%; height:100%;">
<iframe name="framename" style="width:100%;height:100%" id="myframe" src="Areas/askue_akt/App_Data/08022011000000.html"></iframe>
</div>
iframe中的html:
<head>
<meta http-equiv=Content-Type content="text/html; charset=windows-1251">
<meta name=ProgId content=Excel.Sheet>
<meta name=Generator content="Microsoft Excel 11">
<link id=Main-File rel=Main-File href="../08022011000000.html">
<link rel=File-List href=filelist.xml>
<link rel=Edit-Time-Data href=editdata.mso>
<link rel=Stylesheet href=stylesheet.css>
<style>
<!--table...
首先:Excel產生災難性的HTML。 您很幸運,它完全有效。 即使微軟自己的IE也無法應付這一事實,也應單獨暗示它的嚴重程度。 因此,您首先應該考慮的是,是否除了使用Excel的HTML之外沒有其他選擇。 您可以嘗試驗證 HTML並糾正錯誤,但是錯誤的數量可能會很大。
為了解決樣式表問題,您應該做的一件事就是檢查服務器是否使用了正確的MIME類型。 這在Firefox中最容易出現。 直接在瀏覽器中加載CSS的URL,然后檢查菜單工具>頁面信息。 在“類型:”下應顯示text/css
。 如果沒有,那么您的服務器配置可能出了點問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.