阿里云服务器

今天给大家分享,帝国cms手机跳转代码,常用的百度跳转代码,只能把所有页面都跳转到一个页面。

通过下面代码就可以自动跳转到对应的手机url页面。

首页跳转代码:

<script type="text/javascript">
if(/AppleWebKit.*mobile/i.test(navigator.userAgent)){if(window.location.href.indexOf("from=mobile")==-1&&document.cookie.indexOf("from=mobile")==-1){try{if(/Android|webOS|iPhone|iPod|iPad/i.test(navigator.userAgent)){window.location.href="/e/wap/"}}catch(e){}}}
</script>

栏目页跳转代码:

<script type="text/javascript">
if(/AppleWebKit.*mobile/i.test(navigator.userAgent)){if(window.location.href.indexOf("from=mobile")==-1&&document.cookie.indexOf("from=mobile")==-1){try{if(/Android|webOS|iPhone|iPod|iPad/i.test(navigator.userAgent)){window.location.href="/e/wap/list.php?classid=[!--self.classid--]&style=0&bclassid=[!--bclass.id--]"}}catch(e){}}}
</script>

文章页面跳转代码:

<script type="text/javascript">
if(/AppleWebKit.*mobile/i.test(navigator.userAgent)){if(window.location.href.indexOf("from=mobile")==-1&&document.cookie.indexOf("from=mobile")==-1){try{if(/Android|webOS|iPhone|iPod|iPad/i.test(navigator.userAgent)){window.location.href="/e/wap/show.php?classid=[!--classid--]&id=[!--id--]&style=0&bclassid=[!--bclass.id--]&cid=[!--classid--]&cpage=0"}}catch(e){}}}
</script>

通过以上三个代码即可轻松实现手机页面的跳转。

相关阅读:
  • 帝国CMS系统调用随机文章列表的方法
  • 帝国CMS系统调用搜索关键词文章列表的方法