2010-05-10 140 views
0

看来,IE8不能正常呈现一个本地文件:IE8渲染是错误的

考虑一个简单的网页:http://sayang.free.fr/ie8render.html(HTML代码如下)从不透明一个W3C教程提取。

本地保存并再次显示:本地文件没有不透明度!

这非常烦人,尤其是当想要在放置在本地文件中的原型上设计复杂页面时。

你有解决方案吗?

<html> 
    <head> 
    <title>IE8 Local File</title> 
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> 
    <meta http-equiv="pragma" content="no-cache" /> 
    <meta http-equiv="cache-control" content="no-cache" /> 
    <meta http-equiv="expires" content="-1" /> 

    <style type="text/css"> 
    div.background 
     { 
     width: 500px; 
     height: 250px; 
     background: url(http://www.w3schools.com/css/klematis.jpg) repeat; 
     border: 2px solid black; 
     } 
    div.transbox 
     { 
     width: 400px; 
     height: 180px; 
     margin: 30px 50px; 
     background-color: #ffffff; 
     border: 1px solid black; 
     /* for IE */ 
     filter:alpha(opacity=60); 
     /* CSS3 standard */ 
     opacity:0.6; 
     } 
    div.transbox p 
     { 
     margin: 30px 40px; 
     font-weight: bold; 
     color: #000000; 
     } 
    </style> 
    </head> 
    <body> 
    <h2>Save this file locally and open it to see the difference</h2> 
    <div class="background"> 
     <div class="transbox"> 
     <p>This is some text that is placed in the transparent box. This is some text that is placed in the transparent box. This is some text that is placed in the transparent box. This is some text that is placed in the transparent box. This is some text that is placed in the transparent box.</p> 
     </div> 
    </div> 
    </body> 
</html> 

回答

0

其实现在的工作:2年后,微软必须提高本地文件浏览。 现在它会提示执行javascript并实际执行它,就好像页面是远程的一样。

非常感谢所有花时间回复的人。 干杯

0

如果你知道你的代码在IE7你可以强制IE8浏览器,包含以下标签使用IE7标准内<head>

<meta http-equiv="X-UA-Compatible" content="IE=7"> 
+0

我的积分如何增加? – Kasturi 2010-05-12 12:43:51

1

之前只是<html>(或之间加入这样的事情和<html>):

<!-- saved from url=(0023)http://www.example.com/ --> 

如果这是存在,Internet Explorer的行为,如果它已获取的页面从远程Web服务器,而不是加载它直接从磁盘。

URL可以几乎任何你想要的,但括号中的数字必须是URL的长度。

我不能保证它会工作,但给它一个尝试,如果你想继续在这个老问题:)

+0

有趣。这有帮助吗?如果它确实如此:*为什么?* – 2011-03-24 11:41:57

+0

那么,它肯定会有所作为。当Internet Explorer保存页面时(通过文件|保存),它会添加一个类似的评论。我怀疑这是一个可用性的东西。本地计算机上的文件通常会落入不同的安全区域,但这会使保存页面的用户感到困惑,然后再尝试在本地打开它,但发现它不起作用。 – Wodin 2011-03-25 22:38:00