一、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;

        }
05-03 23:14