问题描述
由于某些未知的原因,我正在处理的网站保持交叉匹配的浏览器和文档模式。当我打开IE8开发工具时,我发现浏览器模式是IE8,但文档模式是IE7。
我做了几个文档类型更改,但无法自动获取网站加载浏览器模式下的文档模式也就是IE8。
当前Doctype声明:
<%@ Page Language =vbAutoEventWireup =trueSrc =Scripts / Splash.aspx.vbInherits =SplashFunctionality%>
<!DOCTYPE HTML PUBLIC - // W3C // DTD HTML 4.01 // ENhttp://www.w3.org/TR/html4/strict.dtd\">
< html>
< head>
< meta http-equiv =Content-Typecontent =text / html; charset = utf-8>
< title>欢迎来到CAE的KC-135 ATS主页< / title>
< link rel =stylesheettype =text / csshref =CSS / HomeStyles.css/>
< link rel =stylesheettype =text / csshref =CSS / headerStyles.css/>
< script type =text / javascriptsrc =Scripts / Roladex.js>< / script>
< script type =text / javascriptsrc =Scripts / HeaderNav.js>< / script>
< script type =text / javascriptsrc =Scripts / HomeFunctionality.js>< / script>
< script type =text / javascriptsrc =Scripts / JSTweener.js>< / script>
< / head>
< body>
发生这种情况的原因通常是因为配置设置在IE中,它告诉它在某些条件下切换到兼容模式。当您在本地网络中浏览网站时,通常会发生这种情况 - 所以当您测试正在开发的网站时,通常会发生这种情况。
当然,通过更改配置关闭它。但是用户仍然可以启用该设置,因此您需要尝试在网站中处理它。
执行此操作的方法是设置 X-UA兼容
元标志,您可以使用它来强制IE进入正确的模式。
大多数情况下,最好的设置如下:
< meta http-equiv =X-UA兼容 content =IE = edge/>
将此代码添加到代码的顶部,位于< head>
block。
希望有帮助。
For some unknown reason the site im working on keeps cross matching browser and document mode. When i open IE8 dev tools i see that browser mode is IE8 but document mode is IE7.
I've made several doctype changes but am unable to get the site to automatically load in the browser mode for the document mode also namely IE8.
Current Doctype declaration:
<%@ Page Language="vb" AutoEventWireup="true" Src="Scripts/Splash.aspx.vb" Inherits="SplashFunctionality"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Welcome to CAE's KC-135 ATS Home</title>
<link rel="stylesheet" type="text/css" href="CSS/HomeStyles.css"/>
<link rel="stylesheet" type="text/css" href="CSS/headerStyles.css"/>
<script type="text/javascript" src="Scripts/Roladex.js"></script>
<script type="text/javascript" src="Scripts/HeaderNav.js"></script>
<script type="text/javascript" src="Scripts/HomeFunctionality.js"></script>
<script type="text/javascript" src="Scripts/JSTweener.js"></script>
</head>
<body>
The reason this happens is typically because of a config setting in IE, which tells it to switch into compatibility mode under certain conditions. This is often set to happen when you browse a site in your local network -- so it often happens when you are testing a site you're developing.
You can, of course, switch it off by changing the config. But it's still possible for your users to have that setting turned on, so you need to try to deal with it within the site.
The way to do this is to set the X-UA-Compatible
meta flag, which you can use to force IE into the correct mode.
In most cases, the best setting for this is as follows:
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
Add this to the top of your code, inside the <head>
block.
Hope that helps.
这篇关于为什么网页在IE8浏览器模式和IE7文件模式下显示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!