收藏
回答

微信浏览器script随机加载失败

很早之前反馈过相同的问题, 页面加载script随机出现加载失败的问题


总是报错Can't find variable xxx 或者xxx is undefined这种问题


from agent{Mozilla/5.0 (iPhone; CPU iPhone OS 12_1_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/16D57 MicroMessenger/7.0.8(0x17000820) NetType/WIFI Language/zh_CN} Thu Jan 02 20:17:41 CST 2020       window error, after page load 1122ms,log{"msg":"ReferenceError: Can't find variable: dealContentFile","url":"","line":927,"col":19,"error":{"line":927,"column":19,"sourceURL":""}}

from agent{Mozilla/5.0 (iPhone; CPU iPhone OS 12_1_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/16D57 MicroMessenger/7.0.8(0x17000820) NetType/WIFI Language/zh_CN} Thu Jan 02 20:17:41 CST 2020       window error, after page load 1133ms,log{"msg":"ReferenceError: Can't find variable: EJS","url":"","line":1197,"col":35,"error":{"line":1197,"column":35,"sourceURL":""}}


from agent{Mozilla/5.0 (iPhone; CPU iPhone OS 13_1_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/7.0.8(0x17000820) NetType/4G Language/zh_CN} Thu Jan 02 20:17:53 CST 2020  window error, after page load 1179ms,log{"msg":"ReferenceError: Can't find variable: getCourseShare","url":"","line":925,"col":20,"error":{"line":925,"column":20,"sourceURL":""}}



问题中的js引入方式, 都是通过script标签, 非微信浏览器都正常

<script src="/mx-static/js/tmpl/ejs/ejs_production.js"></script>



ps: 记得3年前反馈的时候, 微信的攻城狮联调过, 如果微信使用debug模式, 或者内置浏览器, 就不会出现问题了, 当时承诺发现问题后的半年, 也就是当年10月份可以上线解决, 但现在3年多都没解决, 我现在只想知道我怎么避免这种问题, 不报希望了!!!!!!!!!!



------

补充新报错log

JsLogController.jsConsole->() from agent{Mozilla/5.0 (iPhone; CPU iPhone OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/7.0.8(0x17000820) NetType/WIFI Language/zh_CN} Sat Jan 04 21:53:48 CST 2020     window error, after page load 56ms,log{"msg":"TypeError: undefined is not an object (evaluating 'document.getElementsByTagName('body')[0].appendChild')","url":"http://m.minstars.cn/mx-static/js/bootstrap/bootstrap.min.js?t=1570864964521","line":1,"col":137,"error":{"line":1,"column":137,"sourceURL":"http://m.minstars.cn/mx-static/js/bootstrap/bootstrap.min.js?t=1570864964521"}}

JsLogController.jsConsole->() from agent{Mozilla/5.0 (iPhone; CPU iPhone OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/7.0.8(0x17000820) NetType/WIFI Language/zh_CN} Sat Jan 04 21:53:48 CST 2020     window error, after page load 18ms,log{"msg":"Script error.","url":"","line":0,"col":0,"error":null}

JsLogController.jsConsole->() from agent{Mozilla/5.0 (iPhone; CPU iPhone OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/7.0.8(0x17000820) NetType/WIFI Language/zh_CN} Sat Jan 04 21:53:48 CST 2020     window error, after page load 21ms,log{"msg":"Script error.","url":"","line":0,"col":0,"error":null}

JsLogController.jsConsole->() from agent{Mozilla/5.0 (iPhone; CPU iPhone OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/7.0.8(0x17000820) NetType/WIFI Language/zh_CN} Sat Jan 04 21:53:48 CST 2020     window error, after page load 22ms,log{"msg":"TypeError: undefined is not an object (evaluating 'document.getElementsByTagName('body')[0].appendChild')","url":"http://m.minstars.cn/mx-static/js/cookie/jquery.cookie.js?t=1570864964521","line":1,"col":137,"error":{"line":1,"column":137,"sourceURL":"http://m.minstars.cn/mx-static/js/cookie/jquery.cookie.js?t=1570864964521"}}


JsLogController.jsConsole->() from agent{Mozilla/5.0 (iPhone; CPU iPhone OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/7.0.8(0x17000820) NetType/WIFI Language/zh_CN} Sat Jan 04 21:53:48 CST 2020     window error, after page load 720ms,log{"msg":"ReferenceError: Can't find variable: layer","url":"","line":618,"col":34,"error":{"line":618,"column":34,"sourceURL":""}}

JsLogController.jsConsole->() from agent{Mozilla/5.0 (iPhone; CPU iPhone OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/7.0.8(0x17000820) NetType/WIFI Language/zh_CN} Sat Jan 04 21:55:53 CST 2020 window error, after page load 43ms,log{"msg":"Script error.","url":"","line":0,"col":0,"error":null}

JsLogController.jsConsole->() from agent{Mozilla/5.0 (iPhone; CPU iPhone OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/7.0.8(0x17000820) NetType/WIFI Language/zh_CN} Sat Jan 04 21:55:53 CST 2020 window error, after page load 49ms,log{"msg":"TypeError: undefined is not an object (evaluating 'document.getElementsByTagName('body')[0].appendChild')","url":"http://m.minstars.cn/mx-static/js/cookie/jquery.cookie.js?t=1570864964521","line":1,"col":137,"error":{"line":1,"column":137,"sourceURL":"http://m.minstars.cn/mx-static/js/cookie/jquery.cookie.js?t=1570864964521"}}

JsLogController.jsConsole->() from agent{Mozilla/5.0 (iPhone; CPU iPhone OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/7.0.8(0x17000820) NetType/WIFI Language/zh_CN} Sat Jan 04 21:55:53 CST 2020 window error, after page load 48ms,log{"msg":"Script error.","url":"","line":0,"col":0,"error":null}

JsLogController.jsConsole->() from agent{Mozilla/5.0 (iPhone; CPU iPhone OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/7.0.8(0x17000820) NetType/WIFI Language/zh_CN} Sat Jan 04 21:55:53 CST 2020 window error, after page load 56ms,log{"msg":"TypeError: undefined is not an object (evaluating 'document.getElementsByTagName('body')[0].appendChild')","url":"http://m.minstars.cn/mx-static/js/bootstrap/bootstrap.min.js?t=1570864964521","line":1,"col":137,"error":{"line":1,"column":137,"sourceURL":"http://m.minstars.cn/mx-static/js/bootstrap/bootstrap.min.js?t=1570864964521"}}


JsLogController.jsConsole->() from agent{Mozilla/5.0 (iPhone; CPU iPhone OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/7.0.8(0x17000820) NetType/WIFI Language/zh_CN} Sat Jan 04 21:55:54 CST 2020 window error, after page load 480ms,log{"msg":"ReferenceError: Can't find variable: layer","url":"","line":618,"col":34,"error":{"line":618,"column":34,"sourceURL":""}}


JsLogController.jsConsole->() from agent{Mozilla/5.0 (iPhone; CPU iPhone OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/7.0.8(0x17000820) NetType/4G Language/zh_CN} Sat Jan 04 21:56:02 CST 2020   window error, after page load 9ms,log{"msg":"Script error.","url":"","line":0,"col":0,"error":null}

JsLogController.jsConsole->() from agent{Mozilla/5.0 (iPhone; CPU iPhone OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/7.0.8(0x17000820) NetType/4G Language/zh_CN} Sat Jan 04 21:56:02 CST 2020   window error, after page load 12ms,log{"msg":"Script error.","url":"","line":0,"col":0,"error":null}

JsLogController.jsConsole->() from agent{Mozilla/5.0 (iPhone; CPU iPhone OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/7.0.8(0x17000820) NetType/4G Language/zh_CN} Sat Jan 04 21:56:02 CST 2020   window error, after page load 50ms,log{"msg":"TypeError: undefined is not an object (evaluating 'document.getElementsByTagName('body')[0].appendChild')","url":"http://m.minstars.cn/mx-static/js/cookie/jquery.cookie.js?t=1570864964521","line":1,"col":137,"error":{"line":1,"column":137,"sourceURL":"http://m.minstars.cn/mx-static/js/cookie/jquery.cookie.js?t=1570864964521"}}

JsLogController.jsConsole->() from agent{Mozilla/5.0 (iPhone; CPU iPhone OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/7.0.8(0x17000820) NetType/4G Language/zh_CN} Sat Jan 04 21:56:02 CST 2020   window error, after page load 58ms,log{"msg":"TypeError: undefined is not an object (evaluating 'document.getElementsByTagName('body')[0].appendChild')","url":"http://m.minstars.cn/mx-static/js/bootstrap/bootstrap.min.js?t=1570864964521","line":1,"col":137,"error":{"line":1,"column":137,"sourceURL":"http://m.minstars.cn/mx-static/js/bootstrap/bootstrap.min.js?t=1570864964521"}}

JsLogController.jsConsole->() from agent{Mozilla/5.0 (iPhone; CPU iPhone OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/7.0.8(0x17000820) NetType/4G Language/zh_CN} Sat Jan 04 21:56:03 CST 2020   window error, after page load 801ms,log{"msg":"ReferenceError: Can't find variable: layer","url":"","line":618,"col":34,"error":{"line":618,"column":34,"sourceURL":""}}

最后一次编辑于  2020-01-04
回答关注问题邀请回答
收藏

3 个回答

  • 建波
    建波
    2020-03-15

    我也有同样的问题。很紧急,百万PV以上系统

    发生时间:从2020年1月初开始,至今3月15号(期间疫情,时间只是大致,可能不是非常精准),陆续有用户反馈页面故障,逐渐增多。

    发生地区:一开始集中在浙江湖州,大约3月9号(时间可能不是非常精准)以后别的省份扩散。

    己方系统故障可能:不太像,经过多次排查,和多次尝试,还是出现用户页面故障。老的jquery技术、无es6以上语法、己方上次发布1月7号和1月9号,无灰度发布功能

    3.15号己方同事测试:同一个链接,有同事出现同样故障

    我方采取的猜测性解决方案

    通过对用户日志的收集,提示Can't find variable XX,这个XX是定义在body里的一个script脚本内部函数名称。

    1.修改XX变量名:无效

    2.清除微信缓存:无效,但不确定

    3.直接删除XX的script脚本:依然有用户同样故障,但是不再提示Can't find variable XX;再次通过日志收集,页面没有报错,页面head里执行正常,但是没有后续日志记录了,发现很像body里的script脚本没有加载。

    4.让用户访问一个新的链接,再次访问故障链接:故障页面正常了

    结论:

    目前看起来比较像上面同学所说的随机性加载scritp失败问题

    故障页面地址:(已去除XX的JS库)

    http://wap.yun-gui.com/mapi/pickUpDetail2.html?qjm=91196630&tel=13127583686&sid=33047&expressId=1161573066657107968

    链接会提示需要先关注公众号、绑定手机号后,再打开此链接

    故障:取件码不展示,大多数用户能显示,个别用户不显示。是否和后台网络请求有关:基本确定无关。

    请联系邮箱jianbo.duan@foxmail.com 微信号:17701645562

    2020-03-15
    有用 1
    回复 2
    • 周玉波
      周玉波
      2020-03-15
      你们现在有解决方案了么?
      2020-03-15
      回复
    • 建波
      建波
      2020-03-15回复周玉波
      还没有,之前没发现这个问题
      2020-03-15
      回复
  • Wal-le
    Wal-le
    2020-03-22

    我也有碰到这个情况

    https://www.maxmon.top/pixel24/index.html(目标网页)

    https://www.maxmon.top/visit?code=pixel24(使用的jsonp)

    这个脚本里用于记录用户ip的,苹果和安卓默认浏览器可以使用;在安卓微信浏览器里,就会导致图片下载不下来的问题,用调试工具也没有提示报错。

    然后把jsonp的那段script注释掉,就正常,但还是很好奇,为什么会有这个问题

    2020-03-22
    有用
    回复
  • 是柿子啊
    是柿子啊
    2020-01-03

    提供下测试的case呢?

    2020-01-03
    有用
    回复 3
    • 周玉波
      周玉波
      2020-01-04
      讲真, 我不知道怎么模拟, 某些iphone访问有一定几率出现问题, 我只能提供log, 具体什么时候会出现, 我不知道
      2020-01-04
      回复
    • 建波
      建波
      2020-03-15回复周玉波
      你们最近有故障吗,我也有类似问题
      2020-03-15
      回复
    • 周玉波
      周玉波
      2020-03-15回复建波
      这个故障已经有3年多了吧
      2020-03-15
      回复
登录 后发表内容
问题标签