开发者

Android problem in WebView with WebViewClient

开发者 https://www.devze.com 2023-03-31 17:13 出处:网络
I am integrating a webpage for mobile. In my application i used WebView. I displayed a web page in it and when clicking a button it goes to another page. So, i used shouldOverrideUrlLoading() method i

I am integrating a webpage for mobile. In my application i used WebView. I displayed a web page in it and when clicking a button it goes to another page. So, i used shouldOverrideUrlLoading() method in WebViewClient. I have an alert in my webpage and whenever it pop-ups a dialog box shows in webview with the url as its title. So i used this code to display dialog for JsAlert.

webview.setWebChromeClient(new WebChromeClient() {

@Override
public boolean onJsAlert(WebView view, String url, String message, android.webkit.JsResult result) {
    //Toast.makeText(getApplicationContext(), message, Toast.LENGTH_LONG).show();
    alert.setTitle(message);
    alert.setPositiveButton("OK", null);
    alert.show();
    result.confirm();
    return true;
}

Then another webpage(overrided url) has google map. The onJsAlert() is not working for this page. The webpage alert is shown with url as title.

How to 开发者_如何转开发set onJsAlert for overriding page?

0

精彩评论

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

关注公众号