zoukankan      html  css  js  c++  java
  • 自适应两个页面pc端与移动端打开网页时跳转到对应的地址

    实现像淘宝那样的,pc一个网址,切换移动另一个网址

    pc:index.html
    移动:m.html
    设备判断(根据目前设备跳转对应url)

    在js中写

    function browserRedirect() {
    
    var sUserAgent= navigator.userAgent.toLowerCase();
    
    var bIsIpad= sUserAgent.match(/ipad/i) == "ipad";
    
    var bIsIphoneOs= sUserAgent.match(/iphone os/i) == "iphone os";
    
    var bIsMidp= sUserAgent.match(/midp/i) == "midp";
    
    var bIsUc7= sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4";
    
    var bIsUc= sUserAgent.match(/ucweb/i) == "ucweb";
    
    var bIsAndroid= sUserAgent.match(/android/i) == "android";
    
    var bIsCE= sUserAgent.match(/windows ce/i) == "windows ce";
    
    var bIsWM= sUserAgent.match(/windows mobile/i) == "windows mobile";
    
    if (bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM) {
    
    window.location.href= 'm.html;
    
    } else {
    
    window.location= 'index.html';
    
    }
    
    }
    
    browserRedirect();
  • 相关阅读:
    使用RPC的接口创建账户同时购买内存并为其抵押CPU和NET资源
    使用RPC的接口创建账户
    【移动安全基础篇】——21、Android脱壳思路
    插件
    NGUI 优化
    影子
    优化文章索引
    MVC
    《你不常用的c#之XX》
    CMake
  • 原文地址:https://www.cnblogs.com/cyhsmile/p/14244877.html
Copyright © 2011-2022 走看看