Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
367 views
in Technique[技术] by (71.8m points)

android - ERROR/Web Console: Uncaught TypeError: Cannot call method 'getItem' of null at http://m.youtube.com/:844

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Perhaps you need something like:

WebSettings settings = webView.getSettings();

settings.setDomStorageEnabled(true);

source


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...