以下Javascript代碼為通過判斷訪問客戶端的userAgent值,實(shí)現(xiàn)跳轉(zhuǎn)到移動(dòng)端首頁index.html,供借鑒參考:
<script type="text/javascript">
!function(){
if(/phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone/i.test(navigator.userAgent.toLowerCase()) == true){
location.href = '//chiji.qq.com/m/index.html';
}
}();
</script>