聯系官方銷售客服
1835022288
028-61286886
pos3開啟自動識別移動端,但希望為手機增加手動切換為電腦版,以下代碼哪里需要改動?
按照官方手冊 http://www.zbshanke.com/v3doc/2463.html
手機模板里加了“電腦版”切換,但由于開啟了自動識別移動端,所以又轉回了手機版,需求是正常情況下自動識別手機版,但也可以手動切換到pc版,這個怎么解決?
<a href="javascript:dr_goto_pc();">電腦版</a> | <a href="javascript:dr_goto_mobile();">手機版</a> <script type="text/javascript" src="{THEME_PATH}js/jquery.cookie.js"></script> <script type="application/javascript"> var MobileUA = (function() { var ua = navigator.userAgent.toLowerCase(); var mua = { IOS: /ipod|iphone|ipad/.test(ua), //iOS IPHONE: /iphone/.test(ua), //iPhone IPAD: /ipad/.test(ua), //iPad ANDROID: /android/.test(ua), //Android Device WINDOWS: /windows/.test(ua), //Windows Device TOUCH_DEVICE: ('ontouchstart' in window) || /touch/.test(ua), //Touch Device MOBILE: /mobile/.test(ua), //Mobile Device (iPad) ANDROID_TABLET: false, //Android Tablet WINDOWS_TABLET: false, //Windows Tablet TABLET: false, //Tablet (iPad, Android, Windows) SMART_PHONE: false //Smart Phone (iPhone, Android) }; mua.ANDROID_TABLET = mua.ANDROID && !mua.MOBILE; mua.WINDOWS_TABLET = mua.WINDOWS && /tablet/.test(ua); mua.TABLET = mua.IPAD || mua.ANDROID_TABLET || mua.WINDOWS_TABLET; mua.SMART_PHONE = mua.MOBILE && !mua.TABLET; return mua; }()); //SmartPhone if (!MobileUA.SMART_PHONE && !$.cookie('POSCMS_my_test_code')) { // 電腦鏈接地址 // 跳轉首頁 //document.location.href = 'http://www.POSCMS.net'; //跳轉對應當前頁的寫法 document.location.href = '{str_replace('m.POSCMS.net', 'www.POSCMS.net', $my_web_url)}'; } }); // 切換手機端 function dr_goto_mobile() { $.cookie('POSCMS_my_test_code', '1', {expires: 7, path: '/', domain: 'POSCMS.net'}); // 跳轉首頁 //document.location.href = 'http://m.POSCMS.net'; //跳轉對應當前頁的寫法 document.location.href = '{str_replace('www.POSCMS.net', 'm.POSCMS.net', $my_web_url)}'; } // 切換電腦端 function dr_goto_pc() { $.cookie('POSCMS_my_test_code', '1',{expires: 7, path: '/', domain: 'POSCMS.net'}); // 跳轉首頁 //document.location.href = 'http://www.POSCMS.net'; //跳轉對應當前頁的寫法 document.location.href = '{str_replace('m.POSCMS.net', 'www.POSCMS.net', $my_web_url)}'; } </script>