<Script the src = " JS / jQuery-2.2.3.min.js " > </ Script> <Script> var Browser = { versions: function () { var U = the navigator.userAgent, App = of navigator.appVersion; return { // mobile terminal browser version information Trident: u.indexOf ( ' Trident ' )> - . 1 , // IEs core Presto: u.indexOf ( ' Presto ' )> - . 1 , // Opera kernel WebKit: u.indexOf ( ' AppleWebKit ' )> - 1 , // Apple, Google kernel Gecko: u.indexOf ( ' Gecko ' )> - 1 && u.indexOf ( ' KHTML ' ) == - 1 , // Firefox core mobile: !! u.match (/AppleWebKit.*Mobile * /.), // whether the mobile terminal ios: !! u.match (/ \ ( i [^;] +; (U;) CPU?. the Mac the OS X-+ /), // iOS terminal Android: u.indexOf ( ' the Android ' )> - . 1 || u.indexOf ( 'Linux ' )> - . 1 , // Android terminal uc browser or iPhone: u.indexOf ( ' iPhone ' )> - . 1 , // whether the browser for the iPhone or QQHD the iPad: u.indexOf ( ' the iPad ' )> - 1 , // whether the iPad webApp: u.indexOf ( ' Safari ' ) == - 1 // if the web application should not bottom head }; } (), Language: (navigator.browserLanguage || navigator.language) .toLowerCase () } $ ( ' #Download ' ) .on ( ' the Click ' , function () { IF (browser.versions.mobile) { // determines whether the mobile device is opened in the following code .browser var UA = navigator.userAgent.toLowerCase () ; // get the object is determined by the IF (ua.match (/ MicroMessenger / I) == " micromessenger " ) { the console.log ( ' micro-channel browser opens ' ) } the else IF (ua.match (/ weibo / I) == " Weibo " ) { the console.log ( ' social client opens') } The else IF (ua.match (/ QQ / I) == " QQ " ) { the console.log ( ' QQ client opens ' ) } the else IF (browser.versions.ios) { the console.log ( ' the IOS browsing open ' ) } the else IF (browser.versions.android) { the console.log ( ' Andrews browser opens ' ) } } the else { the console.log ( ' the PC browser opens ') } }) </script>
The company's business requirements to determine where to open the browser to perform other business operations, bitter little rookie, I write it down down