gpt4 book ai didi

javascript - 页面以 IE7 文档模式而不是 IE9 打开

转载 作者:可可西里 更新时间:2023-11-01 01:57:36 29 4
gpt4 key购买 nike

我知道这里问过这个问题的许多变体,但到目前为止我没有尝试过适合我的解决方案。

我希望我的网络应用程序在 IE 中以 IE9 文档模式打开。当我现在打开页面时,它总是在“Internet Explorer7 标准”中打开,而“Internet Explorer9 标准”被列为页面默认值。我尝试了多种标签变体,包括

<meta http-equiv="X-UA-Compatible" value="IE=Edge">

<meta http-equiv="X-UA-Compatible" content="IE=7,IE=9">

(都在 head 标签之后)

我也尝试过条件语句,例如来自 S.O. 的这个例子:

<!--[if IE 7 ]> <body class="ie7> <![endif]-->
<!--[if IE 8 ]> <body class="ie8> <![endif]-->
<!--[if gt IE 8]><!--><body><!--<![endif]-->

目前我正在使用:<!DOCTYPE html>

当然我可以F12手动切换模式,但我想直接在IE9文档模式下打开站点(兼容模式始终默认为IE9兼容模式)。

目前我正在做一个内网开发服务器;我读过这可能是一个因素?但我真的更喜欢客户端的任何解决方案,我可以将其添加到 JS/HTML 中......

最佳答案

开发者工具手动覆盖文档模式

如果 Internet Explorer 9 Standards 被列为页面默认值,这意味着您可能已通过工具将其手动更改为 Internet Explorer 7 Standards。只需在 F12 开发人员工具中将其切换回 Internet Explorer 9 标准即可。

这些工具会记住您明确要求以另一种文档模式显示页面,因此不会恢复为页面默认设置。考虑来自 MSDN 的以下内容:

When you first load a webpage, F12 tools determines the default Document Mode and selects the appropriate mode. The text Page default in parentheses indicates the default mode of the webpage. A check mark appears next to the current mode of the document. Changing the mode causes the webpage to refresh, and remains in this mode until another mode is chosen or the browser is closed.

Navigating the F12 Developer Tools Interface (emphasis in original)

如果您想确认这个答案,请打开一个新的浏览器窗口并导航至 http://stackoverflow.com .您应该在 F12 开发人员工具中注意到它加载了“标准”文档模式(如果您使用的是 IE9,则为 IE9 标准)。

将 Stack Overflow 的文档模式切换为 IE7 标准并刷新浏览器。刷新后你会发现浏览器保持文档模式:Internet Explorer 7 Standards,并将 Internet Explorer 9 Standards 列为(Page Default)。

enter image description here

兼容性 View 设置

根据 MSDN 资源 How Internet Explorer Chooses Between Document Modes ,唯一的其他潜在原因是兼容性 View 设置。

在 Internet Explorer 9 中,单击“工具”,然后单击“兼容性 View 设置”。您可以在那里找到 Intranet 站点的设置。在 Internet Explorer 10(桌面模式)中,您可能需要按 Alt 才能显示“工具”菜单项。

enter image description here

关于javascript - 页面以 IE7 文档模式而不是 IE9 打开,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15795088/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com