오늘은 JS를 사용하여 모바일 클라이언트 플랫폼 및 시스템 플랫폼을 판단하는 방법을 소개하겠습니다.
<script type = "text/javaScript"> // 모바일 측 판사 브라우저 및 운영 체제 플랫폼 기능 chee서 chee서 chee서 cheeckplatform () {if (/android/i.test (navigator.useragent)) {document.write ( "이것은 Android'Browser입니다."); // 이것은 안드로이드의 브라우저 아래의 브라우저입니다. 플랫폼} if (/(iPhoneipadipodios) /i.test (navigator.useragent))) {docum if (/linux/i.test (navigator.platform)) {document.write ( "이것은 Linux 운영 체제입니다."); // 이것은 Linux 운영 체제 플랫폼} if (/micromessenger/i.test (navigator.useragent)) { "micromessenger is the the the the the the the the the the the the the the the the the the the the the brows." 플랫폼}} $ (document) .ready (function () {alert (navigator.platform); CheckPlatform ();}); </script>위의 코드는 jQuery를 사용합니다. jQuery는 실행되기 전에로드해야합니다. 물론 트리거 기능을 삭제할 수 있습니다
PC 운영 체제 플랫폼에 대해서는 판단하지 않겠습니다. 또한 판단 방법에 대해서도 이야기 할 것입니다. 예를 들어, document.write (navigator.platform)를 사용하여 운영 체제 플랫폼을 얻을 수 있습니다. Win32는 Win32에 따라 표시됩니다. Win64는 Win64 등에 표시됩니다.
아래에서 wulin.com의 편집자는 여러분에게 좋은 기능을 추가합니다.
<script type = "text/javaScript"> var browser = {버전 : function () {var u = navigator.useragent, app = navigator.appversion; return {trident : u.indexof ( 'trident')> -1, presto : u.indexof ( 'presto'), webkit : u.indexof ( 'aplewewee). u.indexof ( 'gecko')> -1 && u.indexof ( 'khtml') == -1, mobile : !! u.match (/applewebkit.* mobile.*/) || !! U.Match (/AppleWebKit/), iOS : !! U.match (// (i [^;]+; (u;)? cpu.+mac os x/), android : u.indexof ( 'android')> -1 || u.indexof ( 'linux')> -1, iPhone : u.indexof ( 'iPhone')> -1 | u.indexof ( 'iPad')> -1, webapp : u.indexof ( 'safari') == -1, qqbrw : u.indexof ( 'mqqbrowser')> -1, weixin : u.indexof ( 'micromessenger')> -1, uclowend : u.indexof ( 'ucweb7.')). u.indexof ( 'rv : 1.2.3.4')> -1, ucweb : function () {try {return parsefloat (u.match (/ucweb/d+/./d+/gi) .tostring (). -1) {return true;} else {return false;}}} (), symbian : u.indexof ( 'symbian')> -1, ucsb : u.indexof ( 'firefox/1.')> -1};} ()} if (browser.versions.qqbrw) {qqqqqqq qqQ 브라우저 ");} else {document.write ("기타 브라우저 ");} </script>개인적으로 테스트하고 매우 유용합니다.