错误/网络控制台:未捕获的类型错误:无法在 http://m.youtube.com/:844 调用 null 的方法“getItem" [英] ERROR/Web Console: Uncaught TypeError: Cannot call method 'getItem' of null at http://m.youtube.com/:844

查看:28
本文介绍了错误/网络控制台:未捕获的类型错误:无法在 http://m.youtube.com/:844 调用 null 的方法“getItem"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下错误来自 Android (WebView) 而不是直接来自我自己的代码:

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

除了将该 URL 加载到 WebView 之外,我真的没有做任何特别的事情.大多数时候我不会收到这个错误,所以我假设这可能是因为网络条件不可靠?也许 youtube.com 太忙了?

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.

同样,我自己的代码不知道 getItem 是什么.另一方面,当这个问题发生时,我的 WebView 上的 YouTube 页面只是.

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.

洞察力?

我一直在寻找有关提议的 WebSettings.setDomStorageEnabled(true) 的文档.到目前为止我能找到的唯一提示是 在这个 SO 线程中:正如我之前提到的,这个问题很少发生,自从我发布我的问题以来就没有发生过.所以我必须多了解一点这个和DOM存储"之间的联系,然后才能设计出一种方法来测试/验证这是否能解决问题.

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

我现在可以看到与 DOM 的一些联系,所以看起来@Brian O'Dell 的方向是正确的.我只需要了解 WebSettings.setDomStorageEnabled(true) 的作用.

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.

推荐答案

也许你需要这样的东西:

Perhaps you need something like:

WebSettings settings = webView.getSettings();

WebSettings settings = webView.getSettings();

settings.setDomStorageEnabled(true);

settings.setDomStorageEnabled(true);

来源

这篇关于错误/网络控制台:未捕获的类型错误:无法在 http://m.youtube.com/:844 调用 null 的方法“getItem"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆