开发者

Where are JavaScript exceptions displayed when using Android WebView?

I have this simple HTML that I load into an Android WebView (SDK version 1.5)-

<html>
<body onload="nomethod()">
<h1>Hello World</h1>
开发者_如何转开发</body>
</html>

Function nomethod() doesn't exist but the LogCat doesn't display any error.

It seems that any exception that isn't caught cannot be traced.

Any idea how can I handle or trace uncaught exceptions?

Thanks!


You might be able to get that if you register a WebChromeClient with your WebView. In particular, look at onConsoleMessage().


They aren't displayed unless you've registered a client. Since you're unable to use it, you and your users will never see JSExceptions.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜