开发者

Where are JavaScript exceptions displayed when using Android WebView?

开发者 https://www.devze.com 2022-12-19 11:52 出处:网络
I have this simple HTML that I load into an Android WebView (SDK version 1.5)- <html> <body onload=\"nomethod()\">

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

精彩评论

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