To determine the browser type and terminal source, we have summarized the following:
Determine the browser type:
<! Doctype HTML> <HTML lang = "ZH-CN">
Determine the terminal Source:
Function getterminal () {var type = 'pc'; // The default value is PC. The value can be PC or MT (mobile) var terminal = ''; // terminal ID, which can be iPhone, iPod, Android, or iPad if (navigator. useragent. match (/iPhone/I) | (navigator. useragent. match (/iPod/I) | (navigator. useragent. match (/Android/I) | (navigator. useragent. match (/iPad/I) {type = 'mt';} If (navigator. useragent. match (/iPhone/I) {terminal = 'iphone ';} If (navigator. useragent. match (/iPod/I) {terminal = 'ipod ';} If (navigator. useragent. match (/Android/I) {terminal = 'android';} If (navigator. useragent. match (/iPad/I) {terminal = 'ipad '} return {"type": type, "terminal": terminal };}
Reference: http://www.cnblogs.com/wqing/archive/2012/08/13/2636626.html
Determine the browser type and terminal Source