瀏覽代碼

mobile 로그인수정

huiwon.seo 4 年之前
父節點
當前提交
591f5a77aa
共有 2 個文件被更改,包括 18 次插入12 次删除
  1. 8 3
      src/main/webapp/WEB-INF/jsp/mobile/login/login.jsp
  2. 10 9
      src/main/webapp/resources/js/mobile/common.js

+ 8 - 3
src/main/webapp/WEB-INF/jsp/mobile/login/login.jsp

@@ -44,10 +44,15 @@ $( function(){
                 
                 if( data.code == "00" ) {
                     console.log("checkMobile() -- > " + checkMobile());
+                    console.log( "isMobile() -- > " + isMobile() );
                     
-                    if (checkMobile() == "android") {
-                        window.android.login(data.id, data.pw);
-                    };
+                    if( isMobile() ) {
+                        if( checkDevice() == "android" ) {
+                            window.android.login(data.id, data.pw);
+                        } else if( checkDevice() == "ios" ){
+                            
+                        }
+                    }
                     
                     location.href="/mobile/menu";
                 } else {

+ 10 - 9
src/main/webapp/resources/js/mobile/common.js

@@ -20,19 +20,20 @@ function getAjax( url, vv, success, error, done ){
     };
   });
 };
-function checkMobile(){
-    var varUA = navigator.userAgent.toLowerCase(); //userAgent 값 얻기
-    if ( varUA.indexOf('android') > -1) {
-        //안드로이드
-        return "android";
-    } else if ( varUA.indexOf("iphone") > -1||varUA.indexOf("ipad") > -1||varUA.indexOf("ipod") > -1 ) {
-        //IOS
+
+function isMobile(){
+    return (/iphone|ipad|ipod|android|opera\smini|opera\smobi|symbian|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase()));
+}
+
+function checkDevice(){
+    if( ( /iphone|ipad|ipod/i.test( navigator.userAgent.toLowerCase() ) ) ) {
         return "ios";
+    } else if( ( /iphone|ipad|ipod|android|opera\smini|opera\smobi|symbian|blackberry|mini|windows\sce|palm/i.test( navigator.userAgent.toLowerCase() ) ) ){
+        return "android";
     } else {
-        //아이폰, 안드로이드 외
         return "other";
     }
-};
+}
 
 function onlyNumber() {
     if((event.keyCode<48) || (event.keyCode>57)) {