织梦移动端各个页面单独跳转代码?首页跳转,栏目页跳转,内页跳转

时间:2023-08-04 11:12:46  作者:往流科技

温馨提醒:这个代码中有个变量 cfg_mobile  是织梦后台自定义的。步骤:系统--系统参数--添加新变量--  输入 变量名 。
变量值是移动网站网址。如果你搭建了移动网站比如http://m.wangliukeji.com  你就直接输入。如果没有,你用织梦做的合并到一起的移动网站。就输入http://www.wangliukeji.com/m   将其中的 域名wangliukeji.com 换成你自己的。然后下面代码才能直接引用{dede:global.cfg_mobile/}  这个参数。


首页跳转

<meta http-equiv="mobile-agent" content="format=xhtml;url={dede:global.cfg_mobile/}">

<script type="text/javascript">

if(window.location.toString().indexOf('pref=padindex') != -1){}

else{

if(/AppleWebKit.*Mobile/i.test(navigator.userAgent) || (/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/.test(navigator.userAgent))){if(window.location.href.indexOf("?mobile")<0){try{if(/Android|Windows Phone|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)){window.location.href="{dede:global.cfg_mobile/}";}else if(/iPad/i.test(navigator.userAgent)){}else{}}catch(e){}}}

}

</script>

列表跳转

<meta http-equiv="mobile-agent" content="format=xhtml;url={dede:global.cfg_mobile/}/list.php?tid={dede:field.id/}">

<script type="text/javascript">if(window.location.toString().indexOf('pref=padindex') != -1){}else{if(/AppleWebKit.*Mobile/i.test(navigator.userAgent) || (/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/.test(navigator.userAgent))){if(window.location.href.indexOf("?mobile")<0){try{if(/Android|Windows Phone|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)){window.location.href="{dede:global.cfg_mobile/}/list.php?tid={dede:field.id/}";}else if(/iPad/i.test(navigator.userAgent)){}else{}}catch(e){}}}}</script>

内容页

<meta http-equiv="mobile-agent" content="format=xhtml;url={dede:global.cfg_mobile/}/view.php?aid={dede:field.id/}">

<script type="text/javascript">if(window.location.toString().indexOf('pref=padindex') != -1){}else{if(/AppleWebKit.*Mobile/i.test(navigator.userAgent) || (/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/.test(navigator.userAgent))){if(window.location.href.indexOf("?mobile")<0){try{if(/Android|Windows Phone|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)){window.location.href="{dede:global.cfg_mobile/}/view.php?aid={dede:field.id/}";}else if(/iPad/i.test(navigator.userAgent)){}else{}}catch(e){}}}}</script>


将这以上不同的代码 加到 对应的pc模板的 中即可。频道页 就按list_article.html 规则写。


相关文章

  • [1]织梦移动端各个页面单独跳转代码?首页跳转,栏目页跳转,内页跳转
  • 
     HTML地图  XML地图