使用jquery设置浏览器模式
问题描述:
每当我打开我的网站时,它都会在浏览器模式下打开:IE8兼容性视图。我不希望我的网站在8或9的兼容性视图中打开。
我需要使用jquery或C#设置IE的浏览器模式。已经设置了IE的文档模式,但是无法使用jquery或C#设置IE的浏览器模式。
我不希望手动设置IE的浏览器模式。
请帮我解决这个问题..
提前感谢你。
Whenever i open my website it opens in Browser Mode : IE8 Compatibility View. I don't want my website to open in compatibility view either 8 or 9.
I need to set a Browser Mode of IE using jquery or C#. Document Mode of IE had been set but Browser mode of IE could not be set using jquery or C#.
I don't want Browser Mode of IE to be set manually.
Please help me to resolve this problem..
Thanking You in advance.
答
你可以使用META
标签来做到这一点。例如,
You could do that by usingMETA
Tag. For example,
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" >
试试这个.. :)) />
http ://万维网.toplinestrategies.com / dotneters / net / detecting-ie-compatibility-view-c /?lang = en [ ^ ]
try this..:)
http://www.toplinestrategies.com/dotneters/net/detecting-ie-compatibility-view-c/?lang=en[^]
var j = jQuery.noConflict();
j(document).ready(function(){
/* detect usage of IE Developer Tools using different Mode for Browser and Document */
if(j.browser.msie) {
var browserVersion = j.browser.version.slice(0,j.browser.version.indexOf("."));
var documentVersion = document.documentMode;
if(browserVersion != documentVersion) {
alert("ERROR:\nBrowser Mode and Document Mode do not match!\n\nBrowser Mode: IE"+ browserVersion +".0\nDocument Mode: IE"+ documentVersion +".0");
}
}
});