Android WebView获取网页中JavaScript弹框内容
网页中弹窗的js代码为
<script type="text/javascript" language="javascript">function duihuan(){alert("请登陆!");}</script>
根据需求要获取 请登录这段文字 具体实现方法如下
在WebView中
WebChromeClient webchromeclient = new WebChromeClient() {public boolean onJsAlert(WebView view, String url, String message,JsResult result) {Toast.makeText(MainActivity.this, message , Toast.LENGTH_LONG).show();result.confirm();return true;}};
message 即为要获取的“请登陆!”
//
原创声明 转载请注明
本文出自Ray-Ray的博客
文章地址/rayray/archive//06/07/3119758.html
感谢大家的推荐和收藏
你的支持! 我们的动力!