zoukankan      html  css  js  c++  java
  • js判断浏览器

    if (navigator.userAgent.indexOf("Opera") != -1) {
    // document.write('您的浏览器是Opera吧?');
    window.location.href = '/LoginMore.aspx';
    }
    // 包含「MSIE」文字列
    else if (navigator.userAgent.indexOf("MSIE") != -1) {
    // document.write('您的浏览器是Internet Explorer吧?');
    window.location.href = '/Login.aspx';
    }
    else if (navigator.userAgent.indexOf('Trident') > -1 && navigator.userAgent.indexOf('rv:11') > -1) {
    //alert('IE11');
    window.location.href = '/Login.aspx';
    } else if (navigator.userAgent.indexOf('MSIE') > -1 && navigator.userAgent.indexOf('Trident') > -1) {

    // alert('IE8-10');
    window.location.href = '/Login.aspx';
    } else if (navigator.userAgent.indexOf('MSIE') > -1) {
    //browser_name='IE(6-7)';
    // alert(6 - 7);
    window.location.href = '/Login.aspx';
    }
    // 包含「Firefox」文字列
    else if (navigator.userAgent.indexOf("Firefox") != -1) {
    // document.write('您的浏览器时Firefox吧?');
    window.location.href = '/LoginMore.aspx';
    }
    // 包含「Netscape」文字列
    else if (navigator.userAgent.indexOf("Netscape") != -1) {
    // document.write('您的浏览器时Netscape吧?');
    window.location.href = '/LoginMore.aspx';
    }
    // 包含「Safari」文字列
    else if (navigator.userAgent.indexOf("Safari") != -1) {
    // document.write('您的浏览器时Safari 吧?');
    window.location.href = '/LoginMore.aspx';
    }
    else {
    // document.write('无法识别的浏览器。');
    window.location.href = '/LoginMore.aspx';
    }

  • 相关阅读:
    redis学习
    Ubuntu命令大全
    关于jquery中attr和prop的用法
    Ubuntu下修改为永久DNS的方法
    Yii2 behaviors中verbs access的一些理解
    vue_ form表单 v-model
    vue-one_demo_music
    ES6
    VUE 入门 01
    Django model.py表单设置默认值允许为空
  • 原文地址:https://www.cnblogs.com/zhangweixin/p/4843706.html
Copyright © 2011-2022 走看看