In my android application I have used web view inside web view I have a button.On clicking that button I am calling a JavaScript function that JavaScript function have an alert box.In that alert title is showing (The page at "file:// "says) . I want to change this title to my custom text. How to change that title ?
I have solved this problem by implementing the setWebChromeClient:
webView.setWebChromeClient(new WebChromeClient() {
@Override
public boolean onJsAlert(WebView view, String url, String message, final JsResult result) {
AlertDialog dialog = new AlertDialog.Builder(view.getContext()).
setTitle("YourAlertTitle").
setMessage(message).
setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
//do nothing
}
}).create();
dialog.show();
result.confirm();
return true;
} });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With