在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
一. IE8兼容视图概述 复制代码 代码如下:<head runat="server"> <meta http-equiv="X-UA-Compatible" content="IE=7" /> <title>cest</title> </head> 如果不写这句,就会默认使用IE8了。 另一个就是在客户端,当网站还没来得及修改Meta时,用户如果装了IE8,发现无法正常显示,这时最后一招就是点击Compatibility View按钮了,它最终体现在User Agent上,也就是说点了兼容性视图按钮,再提交的Http请求头就被改写为 MSIE7.0,使客户端伪装成IE7来发送请求。 如下: User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Trident/5.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E) 按照该MSDN的说法,修改Meta(X-UA-Compatible IE=EmulateIE7)的优先级要高于点击Compatibility View,它可以覆盖掉Compatibility View的选择, 也就是说,一旦网站改版完成发布后,只要设置了Meta , 就可以使原来用户浏览器上设置的Compatibility View作废,从而自动适应新版本的IE8浏览器。 三.IE8兼容视图(IE7 mode)与独立IE7不完全相同 请看Technet.Microsoft的帖子: What Is Compatibility View? http://technet.microsoft.com/zh-cn/ff966533 Compatibility View is a feature of Windows Internet Explorer 8 that enables the browser to render a webpage nearly identically to the way that Windows Internet Explorer 7 would render it. In Internet Explorer 8, Compatibility View changes how the browser interprets code that is written in CSS, HTML, and the Document Object Model (DOM) to try to match Internet Explorer 7. A site that a user views in Internet Explorer 8 Compatibility View is almost identical to a site that the user views in Internet Explorer 7. However, Compatibility View does not change how the browser interprets all code. For example, the changes in Internet Explorer 8 for how the browser handles ActiveX, the parser, AJAX, JavaScript, networking, and security might still cause compatibility issues. Compatibility View does not change these behaviors. In an enterprise environment, some areas have lower risk for compatibility issues. For example, Intranet Zone websites use Compatibility View by default. Client web applications that render by using the Web Browser Control, or the WebOC (Internet Explorer rendering engine), also have a low risk for compatibility issues because Internet Explorer 8 defaults to a compatibility mode for the WebOC. However, the default configuration settings for Compatibility View might not ensure complete compatibility. To determine if a website or web application is compatible with Internet Explorer 8, you should test the website or web application. For more information about the differences between Internet Explorer 8 Compatibility View and Internet Explorer 7, see the Site Compatibility and Internet Explorer 8 blog. For a list of what to check when you upgrade to Internet Explorer 8, see the Internet Explorer 8 Readiness Toolkit. For more information about Compatibility View, see the Internet Explorer Team Blog. 请看MSDN的帖子: 1. Differences between IE8 Compatibility View and IE7 http://blogs.msdn.com/b/ie/archive/2009/03/12/site-compatibility-and-ie8.aspx 摘抄: We strive to make Compatibility View behave as much like IE7 as possible, but we do make exceptions. Many of these exceptions enable improved security and accessibility features immediately, even for sites that have not yet migrated to IE8 Standards Mode. 2. What EXACTLY does Compatibility View do in IE8? http://webmasters.stackexchange.com/questions/2219/what-exactly-does-compatibility-view-do-in-ie8 精华摘抄: Compatibility View renders the page as if it was Internet Explorer 7 (including Javascript). There are a few differences between IE8 with CV and pure IE7 but essentially it is the same. If you really want the detail of what is going on then read Just The Facts: Recap of Compatibility View from the IE MSDN blog. You can also force IE8 to use CV with this meta tag: <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /> If you are having problems, I'd suggest first checking you have a legitimate doctype in your HTML (the simplest one is <!DOCTYPE html> which forces standards mode). That will solve 90% of your problems, especially with IE6. 结论是:IE8兼容模式与独立的IE7是不同的,还是有些差异的,它并不是在IE8里简单包含了一个完整的IE7。 四.具体差异的细节 1. Cross Document Communication Hacks enabling cross-domain, cross-document communication have been disabled for security reasons. 解决方案:Use Cross Document Messaging (XDM) to work around this change. 2. Extending the Event Object IE exposes new properties for certain AJAX features such as Cross Document Messaging (XDM), even in Compatibility View. Adding custom properties to the Event object can conflict with these new properties, such as "source". event.source = myObject; // Read-only in IE8 解决方案: Change the names of conflicting custom properties to avoid collision. event.mySource = myObject; 3. Attribute Ordering The ordering of attributes has changed, affecting the attributes collection as well as the values of innerHTML and outerHTML. Pages depending on a specific attribute ordering may break. attr = elm.attributes[1]; // May differ in IE8 解决方案: Reference attributes by name as opposed to their position within the attributes collection. attr = elm.attributes["id"]; 4. Setting Unsupported CSS Values Assigning CSS values that were unsupported in IE7 but are supported in IE8 Standards Mode will not generate exceptions in IE8 Compatibility View. Some sites use these exceptions to determine if a particular value for a CSS property is supported or not. 复制代码 代码如下:Try { elm.style.display = "table-cell"; } catch(e) { // This executes in IE7, // but not IE8, regardless of mode } 解决方案: Short of version detection, this is a difficult issue to work around. If this behavior is essential to a page, updating the page to run in IE8 Standards Mode may be the best approach. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论