function testB () {
// body...
var isOpera = !!window.opera ||!!window.opr|| navigator.userAgent.indexOf(' OPR/') >= 0;
// Opera 8.0+ (UA detection to detect Blink/v8-powered Opera)
var isFirefox = typeof InstallTrigger !== 'undefined'; // Firefox 1.0+
var isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0;
//var isSafari =/constructor/i.test(window.HTMLElement)
// At least Safari 3+: "[object HTMLElementConstructor]" var isChrome = !!window.chrome && !isOpera; // Chrome 1+
var isIE = /*@cc_on!@*/false || !!document.documentMode; // At least IE6 console.log("是否是ie:"+ isIE);
console.log("是否是chrome:"+ isChrome);
console.log("是否是Firefox:"+ isFirefox);
console.log("是否是opera:"+ isOpera);
console.log("是否是safari:"+isSafari);
if(isIE){
var verIEtrue="";
///
verIEtrue = (function(){
// for-loop saves characters over while
for( var v = 3,
// b just as good as a div with 2 fewer characters
el = document.createElement('b'),
// el.all instead of el.getElementsByTagName('i')
// empty array as loop breaker (and exception-avoider) for non-IE and IE10+
all = el.all || [];
// i tag not well-formed since we know that IE5-IE9 won't mind
el.innerHTML = '<!--[if gt IE ' + (++v) + ']><i><![endif]-->',
all[0];
);
// instead of undefined, returns the documentMode for IE10+ compatibility
// non-IE will still get undefined as before
return v > 4 ? v : document.documentMode;
}() );
///
console.log("ie的版本号:"+ verIEtrue);
} } testB ();

js 判断浏览器和ie版本号 收集的更多相关文章

  1. js判断浏览器种类以及版本号(从jquery1.8中抠出来的)

    var myLibs = { // Use of jQuery.browser is frowned upon. // More details: http://api.jquery.com/jQue ...

  2. JS判断浏览器类型以及版本号

    <script type="text/javascript">        (function(){            window.nav={};       ...

  3. JQuery或JS判断浏览器内核版本号以及是否支持W3C盒子模型

    jQuery 从 1.9 版开始,移除了 $.browser 和 $.browser.version , 取而代之的是 $.support .在更新的 2.0 版本中,将不再支持 IE 6/7/8. ...

  4. 怎么用jquery判断浏览器类型和版本号?

    用jquery判断浏览器类型:判断浏览器类型是IE浏览器还是火狐甚至是opera或者苹果浏览器safari,jquery 特效代码如下:判断浏览器类型和版本号如下: 怎么用jquery判断浏览器类型? ...

  5. JS获取浏览器类型和版本号

    JS获取浏览器类型和版本号,增加了IE11的判断. 2015/7/5更新: 简化代码逻辑 var zbrowser = {} var ua = navigator.userAgent.toLowerC ...

  6. JS判断浏览器类型的方法总结(IE firefox chrome opera safari)

    JS判断浏览器类型的方法总结,可判别当前客户端所使用的浏览器是ie,firefox,safari,chrome或者是opera,另外js可以精确判断到ie浏览器的版本,依然直接上代码,需要的朋友可按照 ...

  7. js判断浏览器类型 js判断ie6不执行

    js判断浏览器类型 $.browser  对象 $.browser.version 浏览器版本 var binfo = ''; if ($.browser.msie) { binfo = " ...

  8. Js 判断浏览器类型整理

    判断原理 JavaScript是前端开发的主要语言,我们可以通过 编写JavaScript程序来判断浏览器的类型及版本.JavaScript判断浏览器类型一般有两种办法,一种是根据各种浏览器独有的属性 ...

  9. JS判断浏览器类型,JS判断客户端操作系统

    JS判断浏览器类型 function judge(){ var browser = { versions: function() { var u = navigator.userAgent, app ...

随机推荐

  1. swift与OC之间不得不知道的21点

    swift与OC之间不得不知道的21点   自6月的WWDC大会上由苹果的大神Chris Lattner向我们首次展示swift至今已经大半年时间了,虽然绝大部分软件公司代码里还都见不到一丁点swif ...

  2. Vim 资料总结

    vi/vim基本使用方法:http://www.cnblogs.com/itech/archive/2009/04/17/1438439.html Vim命令合集: http://www.cnblog ...

  3. c/c++中关于sizeof、strlen的使用说明

    sizeof: 一般指类型.变量等占用的内存大小(由于在编译时计算,因此sizeof不能用来返回动态分配的内存空间的大小) strlen: c字符串的长度(参数必须是字符型指针 char*,当数组名作 ...

  4. git知识点整理

  5. Ternary Expression Parser

    Given a string representing arbitrarily nested ternary expressions, calculate the result of the expr ...

  6. [2013-08-01]window.open

    经常上网的朋友可能会到过这样一些网站,一进入首页立刻会弹出一个窗口,或者按一个连接或按钮弹出,通常在这个窗口里会显示一些注意事项.版权信息.警告.欢迎光顾之类的话或者作者想要特别提示的信息.其实制作这 ...

  7. ssdb binlog机制 存疑

    int BinlogQueue::del_range(uint64_t start, uint64_t end){ while(start <= end){ leveldb::WriteBatc ...

  8. Swift - 3.0之GCD学习

    import UIKit class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoa ...

  9. Swift - 点击事件奇偶次判断

    // 按钮点击事件 func onTouchUpInside() { struct touchUpInside { static var count: Int = 0 } touchUpInside. ...

  10. mac版本cornerstone的无限期破解方法【转】

    CornerStone是个人非常喜欢的mac上的一款SVN客户端工具,官方提供了14天的免费试用(trail)版本.我们可以在此基础上提供无限期试用版本. 方法一:如果你从来没有安装过这个trail版 ...