1. Detection of Android, Apple and Windows Phone phones
var ua = navigator.useragent;
var URL;
if (Ua.match (/windows\sphone/i)!=null) {
Console.log (' This is WindowsPhone ');
}
else if (ua.match (/iphone|ipod/i) = null) {
url = "itms-apps://itunes.apple.com/app/id959587493";
Window.settimeout (function () {
window.location.href = URL;
},10);
}
else if (ua.match (/android/i) = null) {
url = "Http://a.app.qq.com/o/simple.jsp?pkgname=com.electric.chargingpile";
Window.settimeout (function () {
window.location.href = URL;
},10);
}
var ua = navigator.useragent;
var URL;
if (Ua.match (/windows\sphone/i)!=null) {
Console.log (' This is WindowsPhone ');
}
else if (ua.match (/iphone|ipod/i) = null) {
url = "itms-apps://itunes.apple.com/app/id959587493";
Window.settimeout (function () {
window.location.href = URL;
},10);
}
else if (ua.match (/android/i) = null) {
url = "Http://a.app.qq.com/o/simple.jsp?pkgname=com.electric.chargingpile";
Window.settimeout (function () {
window.location.href = URL;
},10);
}
Determine the device as inside the browser
2.if ((/micromessenger/i). Test (Window.navigator.userAgent)) {}
JS Judging Device type