window.onload = function () {
var u = navigator.userAgent;
if (u.indexOf('Android') > -1 || u.indexOf('Linux') > -1) {//安卓手機
alert("安卓手機");
// window.location.href = "mobile/index.html";
} else if (u.indexOf('iPhone') > -1) {//蘋果手機
// window.location.href = "mobile/index.html";
alert("蘋果手機 -"+u);
} else if (u.indexOf('Windows Phone') > -1) {//winphone手機
alert("winphone手機");
// window.location.href = "mobile/index.html";
} else if (u.indexOf('MeeGo') > -1){
alert("MeeGo手機");
} else{
alert(u+"pc");
}
}html