一、PC端跳转到移动端

 html页面:

<script>var webroot="/",catid="{$catid}",murl="m/{$catdir}.html";</script> 
<script src="{JS_PATH}ql/mobile.js"></script>    

mobile.js文件:

if((navigator.userAgent.toLowerCase().match(/(iPhone|iPod|Android|ios)/i))){if(typeof(murl)=="undefined"){var murl="";}location.href=webroot+murl;}

 

二、移动端跳转到PC端

 html页面:

<script>var webroot="/",catid="{$catid}",murl="{$catdir}.html";</script> 
<script src="{JS_PATH}wap/pc.js"></script>        

pc.js文件:

  var is_mobi = navigator.userAgent.toLowerCase().match(/(ipod|iphone|android|coolpad|mmp|smartphone|midp|wap|xoom|symbian|j2me|blackberry|wince)/i) != null;

        if (is_mobi) {

           // window.location.href = "mobile.html";

        }else{

            window.location.href=webroot+murl;

        }

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-26
  • 2022-12-23
  • 2021-11-05
  • 2022-12-23
猜你喜欢
  • 2021-11-26
  • 2022-12-23
  • 2021-09-11
  • 2022-12-23
  • 2022-12-23
  • 2022-01-23
  • 2022-12-23
相关资源
相似解决方案