網站自助識別訪問硬件是手機還是PC

<script type="text/javascript">
    var mobileAgent = new Array("iphone", "ipod", "ipad", "android", "mobile", "blackberry", "webos", "incognito", "webmate", "bada", "nokia", "lg", "ucweb", "skyfire");
    var browser = navigator.userAgent.toLowerCase();
    var isMobile = false;
    for (var i=0; i<mobileAgent.length; i++){ if (browser.indexOf(mobileAgent[i])!=-1){ isMobile = true;
    alert(mobileAgent[i]);
    location.href = 'https://siteapp.baidu.com/webapp/ssffx.com#m/https://www.ssffx.com/';
    <!-- location.href 這一步可以自己進行修改 -->
    break;
         }
    }
</script>

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章