首先要区分网站是自适应还是分离式模板,比如:自适应=PC端和手机端共用模板,分离式=PC端和手机端分开模板

以下代码只需在PC端模板里添加,移动端模板不需要添加。

如果是分离式模板,请在网站模板里的之前加上以下代码:

<meta http-equiv=”mobile-agent” content=”format=xhtml;url={$eyou.field.pageurl_m}”>
<script type=”text/javascript”>if(window.location.toString().indexOf(‘pref=padindex’) != -1){}else{if(/applewebkit.*mobile/i.test(navigator.userAgent.toLowerCase()) || (/midp|symbianos|nokia|samsung|lg|nec|tcl|alcatel|bird|dbtel|dopod|philips|haier|lenovo|mot-|nokia|sonyericsson|sie-|amoi|zte/.test(navigator.userAgent.toLowerCase()))){try{if(/android|windows phone|webos|iphone|ipod|blackberry/i.test(navigator.userAgent.toLowerCase())){window.location.href=”{$eyou.field.pageurl_m}”;}else if(/ipad/i.test(navigator.userAgent.toLowerCase())){}else{}}catch(e){}}}</script>

如果是响应式自适应模板,而且后台开启并配置了手机端域名,请在网站模板里的之前加上以下代码:

<meta http-equiv=”mobile-agent” content=”format=xhtml;url={$eyou.field.pageurl_m}”>
<script type=”text/javascript”>if(window.location.toString().indexOf(‘pref=padindex’) != -1){}else{if(/applewebkit.*mobile/i.test(navigator.userAgent.toLowerCase()) || (/midp|symbianos|nokia|samsung|lg|nec|tcl|alcatel|bird|dbtel|dopod|philips|haier|lenovo|mot-|nokia|sonyericsson|sie-|amoi|zte/.test(navigator.userAgent.toLowerCase()))){try{if(/android|windows phone|webos|iphone|ipod|blackberry/i.test(navigator.userAgent.toLowerCase())){if(window.location.toString().indexOf(‘{$eyou.field.mobile_domain}’) == -1){window.location.href=”{$eyou.field.pageurl_m}”;}}else if(/ipad/i.test(navigator.userAgent.toLowerCase())){}else{}}catch(e){}}}</script>
声明:本网站资源来源于网络收集,如有侵权,请联系站长进行删除处理。 分享目的仅供大家学习和交流,请不要用于商业用途,否则后果自负。本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解。本站资源售价只是赞助,收取费用仅维持本站的日常运营所需。反馈邮箱:1159995880@qq.com