HTML頁面獲取終端型別筆記
阿新 • • 發佈:2018-11-28
// var browser={
// versions:function(){
// var u = navigator.userAgent,
// app = navigator.appVersion;
// return {
// trident: u.indexOf('Trident') > -1, //IE核心
// presto: u.indexOf('Presto') > -1, //opera核心
//
// gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1,//火狐核心
// mobile: !!u.match(/AppleWebKit.*Mobile.*/), //是否為移動終端
// ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios終端
//
// iPhone: u.indexOf('iPhone') > -1 , //是否為iPhone或者QQHD瀏覽器
// iPad: u.indexOf('iPad') > -1, //是否iPad
// webApp: u.indexOf('Safari') == -1, //是否web應該程式,沒有頭部與底部
//
// qq: u.match(/\sQQ/i) == " qq" //是否QQ
// };
// }()
// }
//獲取移動端螢幕寬度
// var wi=window.screen.width;
// alert(window.screen.width )
//
// }