强制IE8或IE9文档模式标准 [英] Force IE8 or IE9 document mode to standards

查看:159
本文介绍了强制IE8或IE9文档模式标准的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Ok对不起,这里是钝的,但我一直在开发IE 8和IE9过去2年,似乎不能得到这个权利。我在abhor公司工作,并为他们的网站发展。由于某种原因IE8或IE9默认为较低的文档模式,如ie7或ie8。我已经尝试了一切...

Ok so sorry for being blunt here but I have been developing on IE 8 and IE9 for the past 2 years and can't seem to get this right. I work at abhor company and develop for their website. For some reason IE8 or IE9 defaults to a lower document mode like ie7 or ie8. I have tried everything...

1)放置HTML 5 doctype,没有别的。根据微软这应该是足够的
2)放html5的doctype,并将x-ua兼容元标记首先在页面下的标题,并设置为边缘或IE8或IE9分别。

1) put HTML 5 doctype and nothing else. According to Microsoft this should be enough 2) put html5 doctype and put x-ua-compatible meta tag first in the page under title and set to either edge or IE8 or IE9 respectively.

我的页面看起来像这样

<!DOCTYPE html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7">
<![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-  ie8"> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9"> <!     [endif]-->
<!--[if gt IE 8]> <html class="no-js"> <!   [endif]-->

<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible"    content="IE=edge,chrome=1">

这真的让人沮丧,因为我读过的一切都说应该有效。 Microsoft声称这将工作,甚至只是设置HTML 5 doctype将工作。我听说设置一个http头修复,但老实说,是微软认真?我发现很难相信开发人员需要改变他们的apache设置,添加一个http头,使页面渲染我是标准模式

It's really getting frustrating because everything I read says it should work. Microsoft claims this will work or even just settings HTML 5 doctype will work. I've heard to set a http header to fix but honestly, is Microsoft serious? I find it hard to believe that developers need tot change their apache settings to add a http header to Make page render I'm standards mode

有人可以帮我吗?我缺少什么?我真的开始讨厌微软更多!!!!!

Can someone please help me here? What am I missing??? I'm really beginning to hate Microsoft Even more!!!!!

UPDATE ::

我最近发现我的公司有显示内部网站的兼容性视图检查,它看起来像我如果取消选中,那么它会工作正常。然而,这不是解决方案!在任何地方,我读,我看到,如果你看到X-UA兼容元标记或http头它应该优先。这是一个完整的谎言。有没有人有答案?我知道外部用户会很好,但我的业务是测试这个,他们提出问题,因为它们是内部的,很难说服他们,并告诉他们取消选中该框。它不给他们一个伟大的感觉。此外,我不能让桌面工程团队删除,因为它已经到位,因为较旧的应用程序内部不是写支持IE8,9,所以他们需要这个。

I recently discovered that my company has the "show intranet sites in compatibility view" checked off and it looks l like if i uncheck it then it will work fine. However, that is not the solution! Everywhere i read i see that if you see the X-UA-compatible meta tag or http header it should take precedence. Well this is a complete lie. Does anyone else have an answer?? I understand that external users will be fine however my business is testing this and they are asking questions because they are internal and its hard to convince them and to tell them to uncheck the box. It doesnt give them a great feeling. Also, i cant have the desktop engineering team remove that because it was put in place because older applications internally are not written to support IE8,9 so they need this.

任何帮助被赞赏。感谢!

Any help is appreciated. thanks!

感谢

推荐答案

我们的内部网络也被锁定兼容性视图用于所有Intranet网站,并使用IE 8,因为它们都是Windows XP。

Our intranet is also locked down with Compatibility View being used for all Intranet sites and uses IE 8 as they are all Windows XP.

我发现一旦IE 8开始处理标准锅炉板条件注释确定哪个类附加到< html> 标签)然后它是游戏结束:IE决定在那一点,它运行在兼容模式(IE 7)

I found that once IE 8 started processing the standard boiler plate conditional comments (to determine which class to attach to the <html> tag) then it was game over: IE decided at that point it was running in Compatibilty Mode (IE 7) and nothing I could do would recover the situation.

我发现通过将< meta> 标记放置在<!DOCTYPE> 标记完全符合预期:

I found that by placing the <meta> tag immediately after the <!DOCTYPE> tag it all worked exactly as expected:

<!DOCTYPE HTML>
<meta http-equiv="x-ua-compatible" content="IE=Edge">

对我来说这看起来不是很标准,但它工作。我喜欢这样做的任何替代方法,其中< meta> 标签可以放置在< head> 因为我尝试了几个小时。

To my eyes this doesn't seem very "standard" but it works. I'd love any alternative methods of doing this where the <meta> tag could be placed into the <head> as I tried for hours to do.

这篇关于强制IE8或IE9文档模式标准的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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