• jquery 判断是否 ie6 ie7 ie8


    1. var isIE = !!window.ActiveXObject;  
    2. var isIE6 = isIE && !window.XMLHttpRequest;  
    3. var isIE8 = isIE && !!document.documentMode;  
    4. var isIE7 = isIE && !isIE6 && !isIE8; 


    var isIE = navigator.userAgent.indexOf('MSIE') != -1;
    var isIE6 = navigator.userAgent.indexOf('MSIE 6.0') != -1;
    var isIE8 = !!window.XDomainRequest && !!document.documentMode;

    <script language="javascript">
        if(window.XMLHttpRequest)//判断浏览器是否属于Mozilla,Sofari
        {
            alert("firefox");
        }
        else if(window.ActiveXObject)//判断浏览器是否属于IE
        {
            var browser=navigator.appName 
            var b_version=navigator.appVersion 
            var version=b_version.split(";"); 
            var trim_Version=version[1].replace(/[ ]/g,""); 
            if(browser=="Microsoft Internet Explorer" && trim_Version=="MSIE7.0") 
            { 
            alert("IE 7.0"); 
            } 
            else if(browser=="Microsoft Internet Explorer" && trim_Version=="MSIE6.0") 
            { 
            alert("IE 6.0"); 
            } 
        }

  • 相关阅读:
    微信小程序开发之选项卡
    sublime text3安装cssrem 插件步骤
    我的第二个Vue项目
    node下载指定版本
    我的第一个vue项目构建
    js实现二级月日联动菜单
    webStrom设置打开默认浏览器
    html-webpack-plugin Configuration配置信息
    webpack html-webpack-plugin 遍历
    git使用笔记
  • 原文地址:https://www.cnblogs.com/AaronYang/p/3138912.html
Copyright © 2020-2023  润新知