金灿灿的朝晖,渐渐染红了东方的天际,高高的黄山主峰被灿烂的云霞染成一片绯红。太阳在朝霞的迎接中,露出了红彤彤的面庞,霎时,万道金光透过树梢给水面染上了一层胭脂红。
一、如果织梦网站手机端是动态地址,按照下面的代码来做即可
织梦PC端首页跳转到手机站首页代码(需要加到pc站头部中):
<metahttp-equiv="mobile-agent"content="format=xhtml;url={dede:global.cfg_mobile/}"> <scripttype="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|WindowsPhone|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)){window.location.rel="nofollow noopener noreferrer" href="{dede:global.cfg_mobile/}/index.php";}elseif(/iPad/i.test(navigator.userAgent)){}else{}}catch(e){}}}}</script>
织梦PC端列表页跳转到手机站列表页代码(需要加到pc站列表页头部中):
<metahttp-equiv="mobile-agent"content="format=xhtml;url={dede:global.cfg_mobile/}/list.php?tid={dede:field.id/}"> <scripttype="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|WindowsPhone|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)){window.location.rel="nofollow noopener noreferrer" href="{dede:global.cfg_mobile/}/list.php?tid={dede:field.id/}";}elseif(/iPad/i.test(navigator.userAgent)){}else{}}catch(e){}}}}</script>
织梦PC端内容页跳转到手机站内容页代码(需要加到pc站内容页头部中):
<metahttp-equiv="mobile-agent"content="format=xhtml;url={dede:global.cfg_mobile/}/view.php?aid={dede:field.id/}"> <scripttype="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|WindowsPhone|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)){window.location.rel="nofollow noopener noreferrer" href="{dede:global.cfg_mobile/}/view.php?aid={dede:field.id/}";}elseif(/iPad/i.test(navigator.userAgent)){}else{}}catch(e){}}}}</script>
二、如果织梦网站手机端是静态地址并且没有开启绝对路径,按照下面的代码来做即可
织梦PC端首页跳转到手机站首页代码(需要加到pc站头部中):
<metahttp-equiv="mobile-agent"content="format=xhtml;url={dede:global.cfg_mobile/}"> <scripttype="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|WindowsPhone|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)){window.location.rel="nofollow noopener noreferrer" href="{dede:global.cfg_mobile/}";}elseif(/iPad/i.test(navigator.userAgent)){}else{}}catch(e){}}}}</script>
织梦PC端列表页跳转到手机站列表页代码(需要加到pc站列表页头部中):
<metahttp-equiv="mobile-agent"content="format=xhtml;url={dede:type}[field:global.cfg_mobile/][field:typeurl/]{/dede:type}"> <scripttype="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|WindowsPhone|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)){window.location.rel="nofollow noopener noreferrer" href="{dede:type}[field:global.cfg_mobile/][field:typeurl/]{/dede:type}";}elseif(/iPad/i.test(navigator.userAgent)){}else{}}catch(e){}}}}</script>
织梦PC端内容页跳转到手机站内容页代码(需要加到pc站内容页头部中):
<metahttp-equiv="mobile-agent"content="format=xhtml;url={dede:global.cfg_mobile/}{dede:field.idrunphp='yes'}$result=GetOneArchive(@me);@me=$result['arcurl'];{/dede:field.id}"> <scripttype="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|WindowsPhone|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)){window.location.rel="nofollow noopener noreferrer" href="{dede:global.cfg_mobile/}{dede:field.idrunphp='yes'}$result=GetOneArchive(@me);@me=$result['arcurl'];{/dede:field.id}";}elseif(/iPad/i.test(navigator.userAgent)){}else{}}catch(e){}}}}</script>
其中cfg_mobile这个是手机域名地址,你可以在织梦后台系统变量里新建变量,变量值是手机域名
三、如果织梦网站手机端是静态地址并且开启绝对路径,按照下面的代码来做即可
到此这篇关于织梦手机端访问pc端网站自动跳转手机端三种情况就介绍到这了。人为善,福虽未至,祸已远离;人为恶,祸虽未至,福已远离。更多相关织梦手机端访问pc端网站自动跳转手机端三种情况内容请查看相关栏目,小编编辑不易,再次感谢大家的支持!