window.isMobile = {
Android: function Android() {
return navigator.userAgent.match(/Android/i);
},
BlackBerry: function BlackBerry() {
return navigator.userAgent.match(/BlackBerry/i);
},
iOS: function iOS() {
return navigator.userAgent.match(/iPhone|iPad|iPod/i);
},
Opera: function Opera() {
return navigator.userAgent.match(/Opera Mini/i);
},
Windows: function Windows() {
return navigator.userAgent.match(/IEMobile/i);
},
any: function any() {
return isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows();
}
};
window.isIE = /(MSIE|Trident\/|Edge\/)/i.test(navigator.userAgent);
window.windowHeight = window.innerHeight;
window.windowWidth = window.innerWidth;
js判斷終端類型和瀏覽器類型
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.