在javascript中设置IE浏览器文档模式 [英] Set IE browser document mode in javascript

查看:575
本文介绍了在javascript中设置IE浏览器文档模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当用户将IE11浏览器的文档模式更改为8.

在我的index.aspx页面中,我想强制将浏览器文档模式设置为最大值。 br />
但是下面的解决方案对我不起作用

< meta http-equiv =X-UA-Compatiblecontent =IE = Edge/>

When user change the document mode of IE11 browser to 8.
In my index.aspx page I want to forcibly set the browser document mode to max value.
but below solution not working properly for me
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />

推荐答案

你不能这样做。因为自己改变了浏览器的状态。让我告诉你,用户永远不会这样做。只有他是开发人员或黑客;如果是负面意义的话。然后他会尝试使用开发人员工具。



我的弟弟甚至不知道他可以从Edge更改IE文档模式( 最新版本,而不是新版本浏览器边缘)到IE 8或7或6.我的父亲甚至不知道有这样的功能;开发者工具。我的祖父甚至不知道是否有IE。所以,这取决于用户。



如果他想在IE 8模式下打开文档,他可以。你不能改变它。因为浏览器不告诉网站用户是否正在更改文档模式,或者是否是第8版(IE)的实际浏览器。还有,是什么让你如此确定用户,如果仍然在IE 11中,无法删除jQuery本身?或者,如果他甚至不允许您的网站发送下载图书馆的请求,该怎么办?有很多事情。



另外,请阅读您问题的第一条评论:为您的网站设计设计以提供相同的功能。或者简单地说,告诉用户使用IE 11; 最差的UX技术。要处理不支持某项功能的浏览器,您应该尝试使用 Modernizr [ ^ ]。
You cannot do so. Because has himself changed the state of browser. Let me tell you, a user would never do that. Only if he is a developer or a hacker; cracker if in negative sense. Then he would try to play around with developer tools.

My younger brother doesn't even know that he can change IE document mode from Edge (latest version, not the new browser Edge) to IE 8 or 7 or 6. My father don't even know there is such a feature; developer tools. My grandfather doesn't even know if there is an IE. So, it depends on the users.

If he wants to open a document in IE 8 mode, he can. You cannot change that. Because browser doesn't tell website whether user is changing the document mode, or whether it is the actual browser with 8th version (of IE). Also, what makes you so sure that user, if still in IE 11, cannot remove jQuery itself? Or what if he doesn't even allow your website to send a request to download the library. There are many things.

Also, read the first comment to your question: Make designs to your website in order to provide a same functionality. Or simply, tell the user to use IE 11; worst UX technique. To handle browsers that do not support a feature, you should try using Modernizr[^].


除了解决方案1:请阅读我对浏览器兼容性的建议:

在不同浏览器中运行时,网页布局会发生变化。 [ ^ ],

如何将桌面网站转换为移动网站 [ ^ ] 。



这里的主要想法是:你无法追逐所有那些浏览器的特性,尤其是IE浏览器。最好的方法是开发Web设计和布局,使其对这些特性不那么敏感,这是通过合理的简单性实现的。相信我:没有人想要看到酷的复杂技巧;人们希望获得良好的可读性,有用的有趣内容和清晰的导航。



-SA
In addition to Solution 1: please read my advice on browser compatibility:
webpages layout change when running in different browsers.[^],
How Do I Convert Desktop Site Into Mobile Site[^].

Main idea here is: you cannot chase all those browser peculiarities, especially with IE. The really best way is to develop Web design and layouts to make it not so sensitive to those peculiarities, which is achieved through reasonable simplicity. Believe me: nobody want's to see "cool" sophisticated tricks; people want good readability, useful interesting content and clear navigation.

—SA


这篇关于在javascript中设置IE浏览器文档模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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