JS判斷瀏覽網頁的設備類型

時間:2017/4/9 15:00:23,點擊:0

<script type="text/javascript"> 
var system ={};
    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){
        document.write("<p>PC</p>");
    }else{  
        document.write("<p>Mobile</p>");
    }
</script>

打印 | 關閉

新疆18选7开奖公告