开发者

WebView causing Uncaught TypeError when loading www.google.com

I'm using WebView to load and render a variety of websit开发者_运维知识库es with no problem. Oddly, the one that seems to cause errors is www.google.com

When loading this page, the Search button does not work when clicked. When it is clicked, I see this error in LogCat (I also see 3 similar errors reported during the page load):

02-07 23:23:59.230: ERROR/Web Console(3721): Uncaught TypeError: Cannot call method 'getItem' of null at http://www.google.com/:342

I am enabling JavaScript (among other things) in my onResume override:

    WebSettings settings = webView.getSettings();
    settings.setJavaScriptEnabled(true);
    settings.setBuiltInZoomControls(true);
    settings.setLoadWithOverviewMode(true);
    settings.setUseWideViewPort(true);
    settings.setDatabaseEnabled(true);

Any idea what could be causing these errors? Thanks!


I found the critical call:

settings.setDomStorageEnabled(true);

This seems to allow the browser to store a DOM model of the page elements, so that Javascript can perform operations on it.


Instead of Google.com try google.lk or google.co.in something. Google.com usually re-directs to someother url.

But ideally even if re-directs it should work.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜