MVC应用程序造成IE9使用旧标准 [英] MVC App causing IE9 to use older standards

查看:132
本文介绍了MVC应用程序造成IE9使用旧标准的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我测试了新的asp.net MVC应用程序我在另一台机器的布局是不正确的,并在IE9似乎很奇怪上创建的。当开发者工具的方式寻找/标准设定为旧版本,甚至兼容模式。我改变了这一回IE9,是确定一次。

When I tested a new asp.net MVC app I created on another machine the layout was incorrect and seemed strange in IE9. When looking at Developer Tools the Mode/Standards were set to older versions and even Compatibility Mode. I changed this back to IE9 and was ok again.

但后来,当我重新打开它再次设置这些值的部位,是有一些默认这些是守覆盖或我由于某种原因导致这些值更改为旧版本的应用程序?

But then when I reopened the site it had set these values back again, is there some default for these that keep overriding or is my app for some reason causing these values to change to older versions?

推荐答案

有一些机制,IE浏览器系列采用猜测渲染模式将是最好的。有关于这个主题的更多阅读:

There is some mechanism, which IE browser family uses to guess what rendering mode would be the best. There is more reading about this topic:

<一个href=\"http://stackoverflow.com/questions/6156639/x-ua-compatible-is-set-to-ie-edge-but-it-still-doesnt-stop-compatibility-mode\">X-UA-Compatible设置为IE =边缘,但它仍然没有停止兼容模式

因此​​,有一个办法怎么说,你的目标而IE浏览器版本。将这个HTML标签作为&LT的第一个(真的是第一次); HEAD&GT; 后元素&LT;标题&GT;

So there is a way how to say, which IE version you are targeting. Put this html tag as the first (really the first) in the <head> element after the <title>

<!DOCTYPE html>
<html>
  <head>
    <title>My Web</title>
    <meta http-equiv="X-UA-Compatible" content="IE=100" >
    ...

含量应包含=IE = 8如果你是针对IE 8.0,IE = 100将为IE 9.0工作++。

content should be contain="IE=8" if you are targeting IE 8.0, IE=100 will work for IE 9.0++.

我读过,这种行为不会在Intranet工作,但我的经历中
  是不同的。关键在于,该 &LT;&荟萃GT; 元素必须是第一个
  第一种方法,的之前无可奉告的。只是没有在标题后的第一个。

I've read that this behavior won't work on intranet, but my experinece is different. The point is that that <meta> element MUST be the first! The first means, no comment before. Nothing just the first one after the title.

例如,我在code服务器端的一些调查,以检查它是什么版本,并把相关的浏览器的元 - 作为第一个元素

这篇关于MVC应用程序造成IE9使用旧标准的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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