业务经理

微信扫描以上二维码

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:感谢,问题已解决

迅睿系统漏洞

GEO系统
GEO系统(2026-09-15)
运营客户端,防止误触阴影处关闭对话框
独立站群系统
独立站群系统(2026-09-14)
子站独立部署时修复同步附件失败问题
在线客服
在线客服(2026-09-13)
修复删除会话报错问题 删除会话时联动删除聊天图片
在线考试竞赛系统
在线考试竞赛系统(2026-09-12)
增加投票功能 考试功能拓展 注意:更新后需要执行系统更新,更新数...
网上信箱
网上信箱(2026-09-12)
修复新版本兼容问题
GeoSeo收录宝
GeoSeo收录宝(2026-09-12)
1 优化Update.php文件,解决版本在线升级不完整问题 2 ...
GeoSeo工具箱
GeoSeo工具箱(2026-09-11)
修正历史记录推送
微信系统
微信系统(2026-09-11)
增加数据统计总览界面 账号管理增加服务和公众号的区别 菜单管理支持更...
答题系统
答题系统(2026-09-11)
一站式在线答题系统,支持真题考试、题库练习和错题本,适合培训、考证、...
阿里云滑动验证码
阿里云滑动验证码(2026-09-10)
采用阿里云验证码替换迅睿系统自带的图片验证码和滑动验证码。后台设置方...