判斷瀏覽器方法
阿新 • • 發佈:2017-06-08
方法 use bre fun window turn andro ray new
//判斷瀏覽器方法 | |
function get_userbrowser(){ | |
var this_userAgent=navigator.userAgent; | |
var keywords=new Array("Android", "iPhone", "iPod", "iPad", "Windows Phone", "MQQBrowser","Firefox","Safari","Opera"); | |
var keywords_leng=keywords.length; | |
for(i=0;i<keywords_leng;i++){ | |
if(this_userAgent.indexOf(keywords[i])!=-1){ | |
return keywords[i]; | |
break; | |
} | |
} | |
} | |
var i_browser=get_userbrowser(); | |
/*if(i_browser=="Android"||i_browser=="iPhone"||i_browser=="iPod"||i_browser=="iPad" || i_browser=="Windows Phone"){ | |
// 判斷是否是 移動設備訪問 然後跳轉到 http://m.huasongauto.com.cn/mobile/ | |
window.location.href = ‘http://m.huasongauto.com.cn/mobile/‘; | |
}*/ | |
判斷瀏覽器方法