如何防止IE9以兼容模式呈现Intranet站点 [英] How to prevent IE9 from rendering intranet sites in compatibility mode

查看:163
本文介绍了如何防止IE9以兼容模式呈现Intranet站点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

IE9有一个奇怪的问题,它以兼容模式呈现内部网站点。

IE9 has a weird problem where it renders intranet sites in compatibility mode.

有没有人知道如何防止这种情况发生?

Does anyone know a way how to prevent this from happening?

注意:我不是在寻找在单个用户计算机上阻止它的方法,但是以某种编程方式阻止网站在兼容模式下呈现。

Note: I am not looking for a way to prevent it on a single users machine, but some programmatic way to prevent the site from ever rendering in compatibility mode.

推荐答案

经过详尽的搜索后,我发现如何成功阻止Intranet站点在IE9中以兼容模式呈现此博客

After an exhaustive search, I found out how to successfully prevent an intranet site from rendering in compatibility mode in IE9 on this blog:

来自Tesmond的博客

IE9中有2个怪癖可能导致兼容模式保持有效。
X-UA-Compatible元元素必须是head部分中的第一个元元素。
在X-UA-Compatible元元素之前,您不能拥有条件IE语句。
这意味着如果您使用Paul Irish的精彩HTML5 Boilerplate,然后在具有默认IE9设置的Intranet上,您的网站将以兼容模式显示。您需要从以下内容更改样板的起点: -

There are 2 quirks in IE9 that can cause compatibility mode to remain in effect. The X-UA-Compatible meta element must be the first meta element in the head section. You cannot have condtional IE statements before the X-UA-Compatible meta element. This means that if you use Paul Irish's wonderful HTML5 Boilerplate then on an Intranet with default IE9 settings your website will display in compatibility mode. You need to change the start of the boilerplate from the following:-

<!doctype html>
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js ie7 oldie" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js ie8 oldie" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

to:

<!doctype html>
<html class="no-js" lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta charset="utf-8">

这篇关于如何防止IE9以兼容模式呈现Intranet站点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆