当前位置: 首页 > cms教程

帝国CMS电脑端自动跳转到手机端方法

时间:2026-01-30 12:03:14

那么,如何识别手机端并自动跳转呢?
在之间增加代码。
电脑端首页跳转

<linkrel=”alternate”media=”onlyscreenand(max-width:640px)”href=”m/”><scriptsrc=”/skin/js/uaredirect/”);</script>
电脑端列表页跳转

<linkrel=”alternate”media=”onlyscreenand(max-width:640px)”href=”m<?=sys_ReturnBqClassUrl($class_r[$GLOBALS[navclassid]]);?>”><scriptsrc=”m/js/uaredirect<?=sys_ReturnBqClassUrl($class_r[$GLOBALS[navclassid]]);?>”);</script>
电脑端内容页跳转

<linkrel=”alternate”media=”onlyscreenand(max-width:640px)”href=”m[!–titleurl–]”><scriptsrc=”/js/uaredirect[!–titleurl–]”);</script>
电脑端端跳转手机端js代码

uaredirect.jsfunctionuaredirect(f){try{if(document.getElementById(“bdmark”)!=null){return}varb=false;if(arguments[1]){vare=window.location.host;vara=window.location.href;if(isSubdomain(arguments[1],e)==1){f=f+”/#m/”+a;b=true}else{if(isSubdomain(arguments[1],e)==2){f=f+”/#m/”+a;b=true}else{f=a;b=false}}}else{b=true}if(b){varc=window.location.hash;if(!c.match(“fromapp”)){if((navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i))){location.replace(f)}}}}catch(d){}}functionisSubdomain(c,d){this.getdomain=function(f){vare=f.indexOf(“://”);if(e>0){varh=f.substr(e+3)}else{varh=f}varg=/^./;if(g.test(h)){h=h.substr(4)}returnh};if(c==d){return1}else{varc=this.getdomain(c);varb=this.getdomain(d);if(c==b){return1}else{c=c.replace(“.”,”.”);vara=newRegExp(“.”+c+”$”);if(b.match(a)){return2}else{return0}}}};


上一篇:帝国CMS模板怎么多规则调用循环子栏目数据?帝国CMS内嵌标签多规则多类型调用循环子栏目数据方法
下一篇:帝国cms灵动标签e:loop调用教程(大集合)
自动跳转
  • 英特尔与 Vertiv 合作开发液冷 AI 处理器
  • 英特尔第五代 Xeon CPU 来了:详细信息和行业反应
  • 由于云计算放缓引发扩张担忧,甲骨文股价暴跌
  • Web开发状况报告详细介绍可组合架构的优点
  • 如何使用 PowerShell 的 Get-Date Cmdlet 创建时间戳
  • 美光在数据中心需求增长后给出了强有力的预测
  • 2027服务器市场价值将接近1960亿美元
  • 生成式人工智能的下一步是什么?
  • 分享在外部存储上安装Ubuntu的5种方法技巧
  • 全球数据中心发展的关键考虑因素
  • 英特尔与 Vertiv 合作开发液冷 AI 处理器

    英特尔第五代 Xeon CPU 来了:详细信息和行业反应

    由于云计算放缓引发扩张担忧,甲骨文股价暴跌

    Web开发状况报告详细介绍可组合架构的优点

    如何使用 PowerShell 的 Get-Date Cmdlet 创建时间戳

    美光在数据中心需求增长后给出了强有力的预测

    2027服务器市场价值将接近1960亿美元

    生成式人工智能的下一步是什么?

    分享在外部存储上安装Ubuntu的5种方法技巧

    全球数据中心发展的关键考虑因素