帝国cmsvip到期不跳到普通会员 帝国cms判断PC端跳转手机端教程

帝国CMS教程

帝国cms判断PC端跳转手机端方法,亲测可用。

首先新建一个JS文件,复制以下代码

functionbrowserRedirect(url){varsUserAgent=navigator.userAgent.toLowerCase();varbIsIphoneOs=sUserAgent.match(/iphoneos/i)=="iphoneos";varbIsMidp=sUserAgent.match(/midp/i)=="midp";varbIsUc7=sUserAgent.match(/rv:1.2.3.4/i)=="rv:1.2.3.4";varbIsUc=sUserAgent.match(/ucweb/i)=="ucweb";varbIsAndroid=sUserAgent.match(/android/i)=="android";varbIsCE=sUserAgent.match(/windowsce/i)=="windowsce";varbIsWM=sUserAgent.match(/windowsmobile/i)=="windowsmobile";if(bIsIphoneOs||bIsMidp||bIsUc7||bIsUc||bIsAndroid||bIsCE||bIsWM){window.location.replace(url);}}

然后再将下面代码复制到对应模板

首页跳转

<scriptsrc='http://www.11px.cn/wap.js'language='javascript'></script><scripttype="text/javascript">browserRedirect("http://www.11px.cn/");</script>

封面页跳转

<scriptsrc='http://www.11px.cn/wap.js'language='javascript'></script><scripttype="text/javascript">browserRedirect("http://www.11px.cn/e/public/ClassUrl/?classid=[!--self.classid--]");</script>

列表页跳转

<scriptsrc='http://www.11px.cn/wap.js'language='javascript'></script><scripttype="text/javascript">browserRedirect("http://www.11px.cn/e/public/ClassUrl/?classid=[!--self.classid--]");</script>

内容页跳转

<scriptsrc='http://www.11px.cn/wap.js'language='javascript'></script><scripttype="text/javascript">browserRedirect("http://www.11px.cn/[!--titleurl--]");</script>

记得将以上代码中域名、路径替换成你的域名、文件路径。