[英]Updating device detection code for Windows 8 mobile devices - phones and Surface X
我以前曾使用附帶的代碼來檢測移動設備,但是(對於顯而易見的原因)它不適用於Windows 8移動電話和任何Surface版本。 我不知道Windows 8手機和Surface的正確userAgent。 為了能夠檢測Surface或Windows 8手機,需要進行哪些更改? 任何幫助將不勝感激 ! 在此先感謝一噸。
function detect() {
var uagent = navigator.userAgent.toLowerCase();
var mobile = false;
var search_strings = [
"iphone",
"ipod",
"ipad",
"series60",
"windows ce",
"windows7phone",
"w7p",
"windows8phone",
"w8p",
"blackberry","
];
for (i in search_strings) {
if (uagent.search(search_strings[i]) > -1)
mobile = true;
}
return mobile;
}
if (detect()){
window.location = "mobile";
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.