欢迎您光临自学哈网,只为分享网络知识教程,供大家学习参考!

「自学哈网」如何让织梦系统dedecms,PC端跳转移动端?

作者 : 自学哈 本文共1253个字,预计阅读时间需要4分钟 2023-08-4 共69人阅读
也想出现在这里? 联系我们

如何让织梦系统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端跳转移动端?
也想出现在这里? 联系我们
© 2022 Theme by - 自学哈网 & WordPress Theme. All rights reserved 浙ICP备2022016594号