zoukankan      html  css  js  c++  java
  • JS判断访问这个页面是win还是Android IOS来源

    window.onload = function(){
    var system ={
    win : false,
    mac : false,
    xll : false
    };
    var p = navigator.platform;
    system.win = p.indexOf("Win") == 0;
    system.mac = p.indexOf("Mac") == 0;
    system.x11 = (p == "X11") || (p.indexOf("Linux") == 0);
    var ios = document.getElementById("ios");
    var andriod = document.getElementById("andriod");
    if(system.win||system.mac||system.xll){
    // ios.style.right = 460+"px";
    // ios.style.bottom = 120+"px";
    // andriod.style.right = 330+"px";
    // andriod.style.bottom = 120+"px";
    }else{
    var sUserAgent = navigator.userAgent.toLowerCase();
    var isIOS = sUserAgent.match(/mac/i) == "mac";
    var isIphone = sUserAgent.match(/iphone/i) == "iphone";
    var isIpad = sUserAgent.match(/ipad/i) == "ipad";
    var isAndroid = sUserAgent.match(/android/i) == "android";
    if(isAndroid){
    //window.location.href='http://api.eguotong.cn/download/android.apk';
    }else if(isIOS || isIpad || isIphone){
    //window.location.href='https://appsto.re/cn/4NI-2.i';
    }else {
    ios.style.right = 460+"px";
    ios.style.bottom = 120+"px";
    andriod.style.right = 330+"px";
    andriod.style.bottom = 120+"px";
    }
    }

  • 相关阅读:
    禁止浏览器缩放功能。
    布局
    设置页面大小
    常用英语
    iOS沙盒路径的简单介绍
    关于 pragma使用
    3Dtouch API Peek and Pop
    3Dtouch API Home Screen Quick Actions
    创建一个.framework静态库
    新学期和学生一起尝试使用博客
  • 原文地址:https://www.cnblogs.com/zhuangjixiang/p/4079396.html
Copyright © 2011-2022 走看看