记录:WebView加载微信公众号发布的文章链接,“阅读原文”无法响应的问题

WebView.loadUrl(微信公众号发布的文章链接)。

可以看到控制台会输出以下log:

11-10 14:47:08.784 2988-2988/com.yxb.oneday I/chromium: [INFO:CONSOLE(540)] "onOutOfWeixinApp", source: http://res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_common/dom/attr275627.js,/mmbizwap/zh_CN/htmledition/js/appmsg/log300330.js,/mmbizwap/zh_CN/htmledition/js/biz_common/dom/class275627.js,/mmbizwap/zh_CN/htmledition/js/biz_wap/utils/device2b3aae.js,/mmbizwap/zh_CN/htmledition/js/biz_wap/jsapi/a8key2a30ee.js,/mmbizwap/zh_CN/htmledition/js/appmsg/index31ab69.js (540)
11-10 14:47:08.784 2988-2988/com.yxb.oneday I/chromium: [INFO:CONSOLE(558)] "进入index.js init", source: http://res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_common/dom/attr275627.js,/mmbizwap/zh_CN/htmledition/js/appmsg/log300330.js,/mmbizwap/zh_CN/htmledition/js/biz_common/dom/class275627.js,/mmbizwap/zh_CN/htmledition/js/biz_wap/utils/device2b3aae.js,/mmbizwap/zh_CN/htmledition/js/biz_wap/jsapi/a8key2a30ee.js,/mmbizwap/zh_CN/htmledition/js/appmsg/index31ab69.js (558)
11-10 14:47:08.874 2988-2988/com.yxb.oneday I/chromium: [INFO:CONSOLE(206)] "[TryCatch][DefineeErr]id:appmsg/async.js", source: http://res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_wap/moon3165f7.js (206)
11-10 14:47:08.886 2988-2988/com.yxb.oneday I/chromium: [INFO:CONSOLE(206)] "[TryCatch]TypeError: version.htmlDecode is not a function
                                                            at r (http://res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/iframe2ff82f.js,/mmbizwap/zh_CN/htmledition/js/appmsg/review_image309c11.js,/mmbizwap/zh_CN/htmledition/js/appmsg/outer_link275627.js,/mmbizwap/zh_CN/htmledition/js/biz_wap/jsapi/core2ffa93.js,/mmbizwap/zh_CN/htmledition/js/biz_common/dom/event275627.js,/mmbizwap/zh_CN/htmledition/js/appmsg/copyright_report2ec4b2.js,/mmbizwap/zh_CN/htmledition/js/appmsg/cache2a74ac.js,/mmbizwap/zh_CN/htmledition/js/appmsg/async31623d.js,/mmbizwap/zh_CN/htmledition/js/biz_wap/ui/lazyload_img309c11.js,/mmbizwap/zh_CN/htmledition/js/biz_common/log/jserr2805ea.js,/mmbizwap/zh_CN/htmledition/js/appmsg/share31b0e8.js,/mmbizwap/zh_CN/htmledition/js/appmsg/cdn_img_lib30b785.js,/mmbizwap/zh_CN/htmledition/js/biz_common/utils/url/parse2fb01a.js,/mmbizwap/zh_CN/htmledition/js/appmsg/test314065.js,/mmbizwap/zh_CN/htmledition/js/biz_wap/utils/mmversion2f1d97.js,/mmbizwap/zh_CN/htmledition/js/appmsg/max_age2fdd28.js?v=1003:408:268)
                                                            at http://res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/iframe2ff82f.js,/mmbizwap/zh_CN/htmledition/js/appmsg/review_image309c11.js,/mmbizwap/zh_CN/htmledition/js/appmsg/outer_link275627.js,/mmbizwap/zh_CN/htmledition/js/biz_wap/jsapi/core2ffa93.js,/mmbizwap/zh_CN/htmledition/js/biz_common/dom/event275627.js,/mmbizwap/zh_CN/htmledition/js/appmsg/copyright_report2ec4b2.js,/mmbizwap/zh_CN/htmledition/js/appmsg/cache2a74ac.js,/mmbizwap/zh_CN/htmledition/js/appmsg/async31623d.js,/mmbizwap/zh_CN/htmledition/js/biz_wap/ui/lazyload_img309c11.js,/mmbizwap/zh_CN/htmledition/js/biz_common/log/jserr2805ea.js,/mmbizwap/zh_CN/htmledition/js/appmsg/share31b0e8.js,/mmbizwap/zh_CN/htmledition/js/appmsg/cdn_img_lib30b785.js,/mmbizwap/zh_CN/htmledition/js/biz_common/utils/url/parse2fb01a.js,/mmbizwap/zh_CN/htmledition/js/appmsg/test314065.js,/mmbizwap/zh_CN/htmledition/js/biz_wap/utils/mmversion2f1d97.js,/mmbizwap/zh_CN/htmledition/js/appmsg/max_age2fdd28.js?v=1003:498:33
                                                            at function.e (http://res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_wap/moon3165f7.js:204:10)
                                                            at i (http://res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_wap/moon3165f7.js:34:5)
                                                            at o (http://res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_common/dom/attr275627.js,/mmbizwap/zh_CN/htmledition/js/appmsg/log300330.js,/mmbizwap/zh_CN/htmledition/js/biz_common/dom/class275627.js,/mmbizwap/zh_CN/htmledition/js/biz_wap/utils/device2b3aae.js,/mmbizwap/zh_CN/htmledition/js/biz_wap/jsapi/a8key2a30ee.js,/mmbizwap/zh_CN/htmledition/js/appmsg/index31ab69.js:336:4)
                                                            at http://res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_common/dom/attr275627.js,/mmbizwap/zh_CN/htmledition/js/appmsg/log300330.js,/mmbizwap/zh_CN/htmledition/js/biz_common/dom/class275627.js,/mmbizwap/zh_CN/htmledition/js/biz_wap/utils/device2b3aae.js,/mmbizwap/zh_CN/htmledition/js/biz_wap/jsapi/a8key2a30ee.js,/mmbizwap/zh_CN/htmledition/js/appmsg/index31ab69.js:559:1
                                                            at u (http://res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_common/dom/attr275627.js,/mmbizwap/zh_CN/htmledition/js/appmsg/log300330.js,/mmbizwap/zh_CN/htmledition/js/biz_common/dom/class275627.js,/mmbizwap/zh_CN/htmledition/js/biz_wap/utils/device2b3aae.js,/mmbizwap/zh_CN/htmledition/js/biz_wap/jsapi/a8key2a30ee.js,/mmbizwap/zh_CN/htmledition/js/appmsg/index31ab69.js:135:4)
                                                            at a (http://res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_common/dom/attr275627.js,/mmbizwap/zh_CN/htmledition/js/appmsg/log300330.js,/mmbizwap/zh_CN/htmledition/js/biz_common/dom/class275627.js,/mmbizwap/zh_CN/htmledition/js/biz_wap/utils/device2b3aae.js,/mmbizwap/zh_CN/htmledition/js/biz_wap/jsapi/a8key2a30ee.js,/mmbizwap/zh_CN/htmledition/js/appmsg/index31ab69.js:113:80)
                                                            at Object.A.onReady (http://res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_common/dom/attr275627.js,/mmbizwap/zh_CN/htmledition/js/appmsg/log300330.js,/mmbizwap/zh_CN/htmledition/js/biz_common/dom/class275627.js,/mmbizwap/zh_CN/htmledition/js/biz_wap/utils/device2b3aae.js,/mmbizwap/zh_CN/htmledition/j
11-10 14:47:08.888 2988-2988/com.yxb.oneday I/chromium: [INFO:CONSOLE(206)] "[TryCatch][DefineeErr]id:appmsg/index.js", source: http://res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_wap/moon3165f7.js (206)
11-10 14:47:08.888 2988-2988/com.yxb.oneday I/chromium: [INFO:CONSOLE(206)] "[TryCatch]TypeError: version.htmlDecode is not a function
                                                            at r (http://res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/iframe2ff82f.js,/mmbizwap/zh_CN/htmledition/js/appmsg/review_image309c11.js,/mmbizwap/zh_CN/htmledition/js/appmsg/outer_link275627.js,/mmbizwap/zh_CN/htmledition/js/biz_wap/jsapi/core2ffa93.js,/mmbizwap/zh_CN/htmledition/js/biz_common/dom/event275627.js,/mmbizwap/zh_CN/htmledition/js/appmsg/copyright_report2ec4b2.js,/mmbizwap/zh_CN/htmledition/js/appmsg/cache2a74ac.js,/mmbizwap/zh_CN/htmledition/js/appmsg/async31623d.js,/mmbizwap/zh_CN/htmledition/js/biz_wap/ui/lazyload_img309c11.js,/mmbizwap/zh_CN/htmledition/js/biz_common/log/jserr2805ea.js,/mmbizwap/zh_CN/htmledition/js/appmsg/share31b0e8.js,/mmbizwap/zh_CN/htmledition/js/appmsg/cdn_img_lib30b785.js,/mmbizwap/zh_CN/htmledition/js/biz_common/utils/url/parse2fb01a.js,/mmbizwap/zh_CN/htmledition/js/appmsg/test314065.js,/mmbizwap/zh_CN/htmledition/js/biz_wap/utils/mmversion2f1d97.js,/mmbizwap/zh_CN/htmledition/js/appmsg/max_age2fdd28.js?v=1003:408:268)
                                                            at http://res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/iframe2ff82f.js,/mmbizwap/zh_CN/htmledition/js/appmsg/review_image309c11.js,/mmbizwap/zh_CN/htmledition/js/appmsg/outer_link275627.js,/mmbizwap/zh_CN/htmledition/js/biz_wap/jsapi/core2ffa93.js,/mmbizwap/zh_CN/htmledition/js/biz_common/dom/event275627.js,/mmbizwap/zh_CN/htmledition/js/appmsg/copyright_report2ec4b2.js,/mmbizwap/zh_CN/htmledition/js/appmsg/cache2a74ac.js,/mmbizwap/zh_CN/htmledition/js/appmsg/async31623d.js,/mmbizwap/zh_CN/htmledition/js/biz_wap/ui/lazyload_img309c11.js,/mmbizwap/zh_CN/htmledition/js/biz_common/log/jserr2805ea.js,/mmbizwap/zh_CN/htmledition/js/appmsg/share31b0e8.js,/mmbizwap/zh_CN/htmledition/js/appmsg/cdn_img_lib30b785.js,/mmbizwap/zh_CN/htmledition/js/biz_common/utils/url/parse2fb01a.js,/mmbizwap/zh_CN/htmledition/js/appmsg/test314065.js,/mmbizwap/zh_CN/htmledition/js/biz_wap/utils/mmversion2f1d97.js,/mmbizwap/zh_CN/htmledition/js/appmsg/max_age2fdd28.js?v=1003:498:33
                                                            at function.e (http://res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_wap/moon3165f7.js:204:10)
                                                            at i (http://res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_wap/moon3165f7.js:34:5)
                                                            at o (http://res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_common/dom/attr275627.js,/mmbizwap/zh_CN/htmledition/js/appmsg/log300330.js,/mmbizwap/zh_CN/htmledition/js/biz_common/dom/class275627.js,/mmbizwap/zh_CN/htmledition/js/biz_wap/utils/device2b3aae.js,/mmbizwap/zh_CN/htmledition/js/biz_wap/jsapi/a8key2a30ee.js,/mmbizwap/zh_CN/htmledition/js/appmsg/index31ab69.js:336:4)
                                                            at http://res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_common/dom/attr275627.js,/mmbizwap/zh_CN/htmledition/js/appmsg/log300330.js,/mmbizwap/zh_CN/htmledition/js/biz_common/dom/class275627.js,/mmbizwap/zh_CN/htmledition/js/biz_wap/utils/device2b3aae.js,/mmbizwap/zh_CN/htmledition/js/biz_wap/jsapi/a8key2a30ee.js,/mmbizwap/zh_CN/htmledition/js/appmsg/index31ab69.js:559:1
                                                            at u (http://res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_common/dom/attr275627.js,/mmbizwap/zh_CN/htmledition/js/appmsg/log300330.js,/mmbizwap/zh_CN/htmledition/js/biz_common/dom/class275627.js,/mmbizwap/zh_CN/htmledition/js/biz_wap/utils/device2b3aae.js,/mmbizwap/zh_CN/htmledition/js/biz_wap/jsapi/a8key2a30ee.js,/mmbizwap/zh_CN/htmledition/js/appmsg/index31ab69.js:135:4)
                                                            at a (http://res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_common/dom/attr275627.js,/mmbizwap/zh_CN/htmledition/js/appmsg/log300330.js,/mmbizwap/zh_CN/htmledition/js/biz_common/dom/class275627.js,/mmbizwap/zh_CN/htmledition/js/biz_wap/utils/device2b3aae.js,/mmbizwap/zh_CN/htmledition/js/biz_wap/jsapi/a8key2a30ee.js,/mmbizwap/zh_CN/htmledition/js/appmsg/index31ab69.js:113:80)
                                                            at Object.A.onReady (http://res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_common/dom/attr275627.js,/mmbizwap/zh_CN/htmledition/js/appmsg/log300330.js,/mmbizwap/zh_CN/htmledition/js/biz_common/dom/class275627.js,/mmbizwap/zh_CN/htmledition/js/biz_wap/utils/device2b3aae.js,/mmbizwap/zh_CN/htmledition/j
11-10 14:47:08.894 2988-2988/com.yxb.oneday I/chromium: [INFO:CONSOLE(206)] "Uncaught TypeError: version.htmlDecode is not a function", source: http://res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_wap/moon3165f7.js (206)

从log可以看出这个页面的加载过程中,有一部分js的加载错问题了,这些问题凑在一起,就导致了。文章底部的“阅读原文”点击后没有反应。


经过测试,是由于Dom内存没有启用,才导致那几条js的加载失败。更具体的原因,就没有查找出来。

所以设置

getSettings().setDomStorageEnabled(true)

刷新一边页面。再次加载,即可看到控制台的log输出变正常了。

11-10 14:58:23.977 9656-9656/com.yxb.oneday I/chromium: [INFO:CONSOLE(397)] "onOutOfWeixinApp", source: appmsg/index.js (397)
11-10 14:58:23.977 9656-9656/com.yxb.oneday I/chromium: [INFO:CONSOLE(415)] "进入index.js init", source: appmsg/index.js (415)
11-10 14:58:24.151 9656-9656/com.yxb.oneday I/chromium: [INFO:CONSOLE(311)] "[moon] load js complete, all in cache, cost time : 0ms, total count : 86, hit num: 86", source: http://res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_wap/moon3165f7.js (311)

“阅读原文”的事件响应也正常了。


你可能感兴趣的:(android)