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

迅睿框架 更新 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:感谢,问题已解决

迅睿系统漏洞

PDF在线预览
PDF在线预览(2026-11-05)
屏蔽资源嗅探
站群分站系统
站群分站系统(2026-11-05)
分站编辑增加「经营信息」:电话、地址、营业时间、备案号。 页脚和 l...
可视化表单
可视化表单(2026-11-04)
短代码嵌入:正文 [xrforms id="1"] 渲染为表单 if...
泛解析站群系统
泛解析站群系统(2026-11-04)
指令支持插入地区占位符 新增 FAQ 标题池随机抽取 修复表头全...
GeoSeo排名助手
GeoSeo排名助手(2026-11-04)
更新排名算法,更稳定更快速
GeoSeo收录宝
GeoSeo收录宝(2026-11-03)
违禁词功能全打通 1. 全局总开关:一键控制整站违禁词功能是否生效...
SEO模板压缩伪原创
SEO模板压缩伪原创(2026-11-02)
增加对泛解析站群支持
CMS建站系统高级版
CMS建站系统高级版(2026-11-02)
增加内容复制功能 增强searchid的安全性校验 避免中文乱码,l...