Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我将这个简单的 HTML 加载到 Android WebView(SDK 版本 1.5)中-
<html> <body onload="nomethod()"> <h1>Hello World</h1> </body> </html>
函数 nomethod() 不存在,但 LogCat 不显示任何错误。 似乎无法追踪任何未捕获的异常。 知道如何处理或跟踪未捕获的异常吗?
谢谢!
如果您在WebChromeClient您的WebView. 特别是看onConsoleMessage()。
WebChromeClient
WebView
onConsoleMessage()
除非您注册了客户,否则它们不会显示。由于您无法使用它,您和您的用户将永远不会看到 JSExceptions。