I'm trying to create a Android WebView app. When I press a button in the webview with the following code behind it:
window.location.href = "https://www.example.nl";
Nothing happens, but in the chrome browser on Android it will work. I can also confirm that javascript is enabled because I can change the backgrond color by using javascript in the webview.
Override the WebView shouldOverrideUrlLoading, like this:
myWebView.setWebViewClient(new WebViewClient() {
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
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