如何恢复“浏览器模式”在IE11? [英] How to bring back "Browser mode" in IE11?

查看:338
本文介绍了如何恢复“浏览器模式”在IE11?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

UPDATE :旧问题仅适用于IE11预览;浏览器模式在IE11的最终版本中返回。但有一个catch:它是没有用的,因为它不模仿有条件的评论。例如,如果您使用它们在旧版IE中启用HTML5支持,您将无法再在IE11中调试您的网站。

 <! -  [if lte IE 8]> 
< script src =html5shiv.js>< / script>
<![endif] - >

阅读另一个和IE 错误跟踪器问题。微软从来没有回应这个,所以看起来他们介绍这个bug,目的是引导人们购买BrowserStack订阅。条件评论模拟在预览版本中运作良好。



ORIGINAL QUESTION
当在Windows 7上安装IE11预览时,与老式的F12工具,允许更改浏览器模式。



但是,如果您转到工具菜单并选择F12开发人员工具,它将替换为新的开发人员工具,并且浏览器模式不再可用。





有没有更简单的方法在IE11的浏览器模式之间切换?

解决方案

[UPDATE]



原始问题, 实际上提供了从开发工具中的仿真标签切换浏览器模式的功能:





说到这里,我在这里使用兼容性模式进行测试仍然有效:如果您想测试您的网站是否与较旧的IE版本兼容,您应该始终在这些IE版本的真实副本中进行测试。



但是,这并不意味着@ EugeneXa的回答中描述的注册表黑客不再需要恢复旧的开发工具,因为新的开发工具现在具有他缺少的功能。





[ORIGINAL ANSWER]



IE浏览器不推荐使用切换浏览器模式的功能。



开发人员在开发工具中切换模式的原因不多,但其中一个主要原因是他们想要测试他们的网站在旧的IE版本。不幸的是,IE提供的各种兼容性模式从来没有真正完全兼容旧版本的IE,并使用compat模式测试根本不是一个足够的替代测试在真实副本的IE8,IE9等。



IE开发人员已经认识到这一点,并且故意使开发人员更难以犯这个错误。



最好的做法是使用



各种兼容性模式在IE11内部仍然可用,但只有在站点显式地表示它要在compat模式下运行。您可以在网页上加入 X-UA-Compatible 标头。



-box仍然可用,但只能提供Edge(即当前IE版本可用的最佳模式,IE11中的IE11模式)或页面运行模式的选项。



因此,如果您转到在兼容模式下加载的页面,您将可以选择在页面加载的特定兼容模式in或IE11Edge模式。



如果您转到以IE11模式加载的页面,那么您将只能获得edge模式, 。



这意味着它仍然允许你测试一个compat模式页面如何反应被更新为在边缘模式下工作,这是唯一真正合法的使用,



IE11文档模式下拉框旁边有一个 i 图标它带你到modern.ie网站。这是为了鼓励您下载MS为我们提供的VM,以使用每个版本的IE的真实副本测试我们的网站。这将给你一个更准确的测试经验,并强烈鼓励作为一个更好的做法,而不是通过切换工具中的模式测试。



希望解释一个事情位。


UPDATE: The old question applies only to IE11 preview; browser mode had returned in final release of IE11. But there is a catch: it is next to useless, because it does not emulate conditional comments. For example, if you use them to enable HTML5 support in legacy IEs, you will no longer be able to debug your site in IE11.

        <!--[if lte IE 8]>
            <script src="html5shiv.js"></script>
        <![endif]-->

Read another StackOverflow question and IE bug tracker issue. Microsoft never responded to this, so it looks like they introduced this bug on purpose to steer people into buying BrowserStack subscriptions. Conditional comment emulation worked just fine in preview release.

ORIGINAL QUESTION: When IE11 preview is installed on Windows 7, it comes with old-fashioned F12 tool which allows to change browser modes.

However, if you go to "Tools" menu and select "F12" developers tool, it gets replaced with new developer tools, and "Browser mode" is no longer available.

The only way to bring it back is to uninstall IE11 and reinstall it.

Is there easier way to switch between browser modes in IE11?

解决方案

[UPDATE]

The original question, and the answer below applied specifically to the IE11 preview releases.

The final release version of IE11 does in fact provide the ability to switch browser modes from the Emulation tab in the dev tools:

Having said that, the advice I've given here (and elsewhere) to avoid using compatibility modes for testing is still valid: If you want to test your site for compatibility with older IE versions, you should always do your testing in a real copy of those IE version.

However, this does mean that the registry hack described in @EugeneXa's answer to bring back the old dev tools is no longer necessary, since the new dev tools do now have the feature he was missing.


[ORIGINAL ANSWER]

The IE devs have deliberately deprecated the ability to switch browser mode.

There are not many reasons why people would be switching modes in the dev tools, but one of the main reasons is because they want to test their site in old IE versions. Unfortunately, the various compatibility modes that IE supplies have never really been fully compatible with old versions of IE, and testing using compat mode is simply not a good enough substitute for testing in real copies of IE8, IE9, etc.

The IE devs have recognised this and are deliberately making it harder for devs to make this mistake.

The best practice is to use real copies of each IE version to test your site instead.

The various compatiblity modes are still available inside IE11, but can only be accessed if a site explicitly states that it wants to run in compat mode. You would do this by including an X-UA-Compatible header on your page.

And the Document Mode drop-box is still available, but will only ever offer the options of "Edge" (that is, the best mode available to the current IE version, so IE11 mode in IE11) or the mode that the page is running in.

So if you go to a page that is loaded in compat mode, you will have the option to switch between the specific compat mode that the page was loaded in or IE11 "Edge" mode.

And if you go to a page that loads in IE11 mode, then you will only be offered the 'edge' mode and nothing else.

This means that it does still allow you to test how a compat mode page reacts to being updated to work in Edge mode, which is about the only really legitimate use-case for the document mode drop-box anyway.

The IE11 Document Mode drop box has an i icon next to it which takes you to the modern.ie website. The point of this is to encourage you to download the VMs that MS are supplying for us to test our sites using real copies of each version of IE. This will give you a much more accurate testing experience, and is strongly enouraged as a much better practice than testing by switching the mode in dev tools.

Hope that explains things a bit for you.

这篇关于如何恢复“浏览器模式”在IE11?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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