业务经理

微信扫描以上二维码

028-61286886

技术咨询

不知道我开发的模版哪里出现了问题手机访问偶尔无法自动跳转到手

迅睿框架 更新 2020-12-24 11:17:10 sunbingchen

不知道我开发的模版哪里出现了问题,http://www.tyjs158.com/手机访问偶尔无法自动跳转到手机端http://m.tyjs158.com/微信截图_20191211203650.png


不知道是不是因为我使用了加速乐 缓存 的问题

方案

  • 迅睿框架创始人 #1 · 2019-12-11 20:39:12
    静态是不能跳转的,要加js识别代码,手册有
  • sunbingchen #2 · 2019-12-11 20:54:54
    回复迅睿框架创始人 我按照https://www.xunruicms.com/doc/664.html这个操作,不知道哪里出问题了 报错 syntax error, unexpected '$my_web_url' (T_VARIABLE), expecting ')'
  • 125762285 #3 · 2019-12-11 21:19:39
    可以在静态页面引入或者加入一个js,由js判断跳转
  • 唉呦喂 #4 · 2019-12-11 23:39:58
    <script type="text/javascript">    
    var siteurl = 'https://m.yourdomain.com';    
    // 跳桌面版    
    if (!(navigator.userAgent.match(/(iPhone|iPod|Android|Windows Phone)/i))) {    
    var url=window.location.href;    
    // url=url.replace('http://m.','http://www.');    
    url=url.replace('https://m.','https://www.');    
    location.replace(url);    
    }    
    </script>    
    
    上面代码是在手机模板head内加入
    <script type="text/javascript">
                var new_url = window.location.href;
                if(new_url.indexOf('http://yourdomain') >= 0 || new_url.indexOf('https://yourdomain') >= 0) {
                    new_url = new_url.replace('http://yourdomain', 'http://www.yourdomain');
                    new_url = new_url.replace('https://yourdomain', 'http://www.yourdomain');
                    window.location.replace(new_url);
                }
                var siteurl = 'http://www.iyourdomain.net/';
            </script>
                    <script type="text/javascript">
                <!--跳m站-->
                function getCookie(nm) {
                    var arr, reg = new RegExp("(^| )" + nm + "=([^;]*)(;|$)");
                    if (arr = document.cookie.match(reg)) {
                        return unescape(arr[2]);
                    } else {
                        return null;
                    }
                }
                if ((navigator.userAgent.match(/(iPhone|iPod|Android|Windows Phone)/i))) {
                    if(getCookie('mfjian') == null) {
                        var url = window.location.href;
                        url = url.replace('http://yourdomain', 'http://m.yourdomain');
                        url = url.replace('https://yourdomain', 'https://m.yourdomain');
                        url = url.replace('http://www.', 'http://m.');
                        url = url.replace('https://www.', 'https://m.');
                        location.replace(url);
                    }
                }/*else{
                    var curProtocol = window.location.protocol.split(':')[0];
                    if (curProtocol === 'http') {
                        var url=window.location.href;
                        url=url.replace('http://','https://');
                        location.replace(url);
                    }
                }*/
            </script>
            
            
             在电脑模板head中加入
  • sunbingchen #5 · 2019-12-12 07:14:28
    唉呦喂 万分感谢
  • sunbingchen #6 · 2019-12-12 13:57:59
    唉呦喂 这个代码好像有点问题,首页一直在加载
  • 唉呦喂 #7 · 2019-12-12 14:04:54
    有地址吗,我帮你看看
  • sunbingchen #8 · 2019-12-12 14:20:35
    满意答案
    唉呦喂 http://www.tyjs158.com/ 应该是yourdomain没替换干净,现在应该是好了
  • sunbingchen #9 · 2019-12-14 09:55:48
    回复迅睿框架创始人 我应该是找到了原因,
    微信截图_20191214095116
    关键就出在了 var is_mobile_cms = '{IS_MOBILE}'; 或许是模版相比官方的改动有点大, 模版是我使用脚手架生成的,https://github.com/xizon/uix-kit/ 使用chrome开发模式 模拟手机访问后,导航的链接全变成了手机链接 var is_mobile_cms = '1'; 没有清空应该全站静态后,这个地方就不能使用php调用了吧 。反正我注释掉就好了,也不知道会不会有其他问题
  • sunbingchen #10 · 2020-12-24 11:17:10
    @sunbingchen:感谢,问题已解决

迅睿系统漏洞

外贸多语言建站
外贸多语言建站(2026-10-30)
修正对百度编辑器提取支持
AI文章生成器
AI文章生成器(2026-10-29)
任务插图设置数量
Bing站长数据
Bing站长数据(2026-10-29)
根据BING接口调整菜单 各个页面数据支持点击查看详情
按字段付费
按字段付费(2026-10-29)
按字段付费用于模块的字段设置一定的价格,当用户购买了此内容的字段时才...
泛解析站群系统
泛解析站群系统(2026-10-29)
AI队列增加清空按钮 表单提示语收敛 目录模式不接管主域名模板
账号注销
账号注销(2026-10-29)
用于用户中心的注销账号申请,后台审核通过后注销此账号。后台统一管理注...
邮件群发
邮件群发(2026-10-28)
修改模板的命名
自定义收款/捐款
自定义收款/捐款(2026-10-28)
自定义收款或捐款插件可以让用户快速创建付款或者捐款功能
CMS内容批量修改
CMS内容批量修改(2026-10-28)
后台批量修改文章内容的指定字段在插件后台可以任意指定字段
全站模块搜索
全站模块搜索(2026-10-28)
实现全模块一次性搜索内容,一键搜索全站内容精准搜索全部模块: