「自学哈网」如何让织梦系统dedecms,PC端跳转移动端?
如何让织梦系统dedecms,PC端跳转移动端?
以下为示例代码:
首页:
<meta name=”mobile-agent” content=”format=html5;url={dede:global.cfg_mobileurl/}/index.php”>
<meta name=”mobile-agent” content=”format=xhtml;url={dede:global.cfg_mobileurl/}/index.php”>
列表页:
<meta name=”mobile-agent” content=”format=html5;url={dede:global.cfg_mobileurl/}/list.php?tid={dede:field.id/}”>
<meta name=”mobile-agent” content=”format=xhtml;url={dede:global.cfg_mobileurl/}/list.php?tid={dede:field.id/}”>
详情页:
<meta name=”mobile-agent” content=”format=html5;url={dede:global.cfg_mobileurl/}/view.php?aid={dede:field.id/}”>
<meta name=”mobile-agent” content=”format=xhtml;url={dede:global.cfg_mobileurl/}/view.php?aid={dede:field.id/}”>
js判断终端的代码:
<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_mobileurl/}/index.php”;}else if(/iPad/i.test(navigator.userAgent)){}else{}}catch(e){}}}}</script>
本站所有资源来源于网络,分享目的仅供大家学习和交流!如若本站内容侵犯了原著者的合法权益,可联系邮箱976157886@qq.com进行删除。
自学哈专注于免费提供最新的分享知识、网络教程、网络技术的资源分享平台,好资源不私藏,大家一起分享!
自学哈网 » 「自学哈网」如何让织梦系统dedecms,PC端跳转移动端?