1. 程式人生 > >記錄:WebView載入微信公眾號釋出的文章連結,“閱讀原文”無法響應的問題

記錄: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)

“閱讀原文”的事件響應也正常了。