java禁用安卓 webview中的弹出窗口和警报框
我使用的是带有javascript功能的webview,因为它在我的应用程序中是必需的。 我的问题是,在我的网络视图中加载url时,我需要避免弹出窗口,有没有办法做到这一点
我遇到了onJsAlert()方法,但根据安卓s文档
Tell the client to display a javascript alert dialog.
If the client returns true, WebView will assume that the client will handle the dialog.
If the client returns false, it will continue execution.
这不是我想要的。我希望避免弹出窗口和警报框(包括提示和确认) 任何帮助都将不胜感激
谢谢
# 1 楼答案
您可以尝试覆盖警报、确认等。可能会添加一个关于何时允许和何时不允许显示警报的标志。 JavaScript: Overriding alert()