Home  >  Article  >  Web Front-end  >  js blocks pc access

js blocks pc access

花姐姐
花姐姐forward
2020-05-06 13:37:513434browse

js blocks pc access

Block PC access

<script type="text/javascript"> 
    //平台、设备和操作系统 
    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);
    if(system.win||system.mac||system.xll){   
        window.location.href="pc端访问的链接";
    }else{ 
    }
</script>

Just replace the link in the code.

Recommended learning: JavaScript

The above is the detailed content of js blocks pc access. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete