Issue
The following error comes from Android (WebView) and not directly from my own code:
04-28 12:36:15.174: ERROR/Web Console(7604):
Uncaught TypeError: Cannot call method 'getItem' of null at http://m.youtube.com/:844
I am really not doing anything special other than loading that URL into WebView. Most of the time I don't get this error, so I am assuming this could be pointing to some unreliable network conditions? Perhaps youtube.com too busy?
It's hard to tell. Regardless, I would like to at least have an idea what could be causing this and whether I can catch that error so that I can better handle it.
Again, my own code has no knowledge of what getItem
is. On the other hand, when this problem occurs, the YouTube page on my WebView is simply empty.
Insights?
EDIT: I have been looking for documentation about the proposed WebSettings.setDomStorageEnabled(true)
. The only hint I have been able to find so far was in this SO thread: As I mentioned earlier, this problem occurs very rarely and haven't occurred since I posted my question. So I must understand a little more about the connection between this and "DOM storage" before I can devise a way to test/verify whether this solves the problem.
Also, I just encountered another error message (with benign results, so it seems):
05-02 00:44:45.823: ERROR/Web Console(1595):
dojo.back.init() must be called before the DOM has loaded.
If using xdomain loading or djConfig.debugAtAllCosts,
include dojo.back in a build layer.
at http://sj.example.com/ncscript/subsect/j_gs/version/20110428191502.js:164
I can now see some connection to DOM, so it looks like @Brian O'Dell is in the right direction. I just need to understand what WebSettings.setDomStorageEnabled(true)
does.
Solution
Perhaps you need something like:
WebSettings settings = webView.getSettings();
settings.setDomStorageEnabled(true);
Answered By - Brian O'Dell
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.