Reputation: 239
In my App I use a webview to open a website. On that website there is a javascript that causes an error. Now, I know that this website uses browser detection and I believe that this might be the problem why the page appears as a blank page in my webview.
Is there a way to somehow imitate a browser so if the js tries to detect the browser it will not fail?
Here is my WebViewClient:
settings.setJavaScriptEnabled(true);
settings.setDomStorageEnabled(true);
webView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
webView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
Log.i(TAG, "Processing webview url click...");
view.loadUrl(url);
return true;
}
@Override
public void onPageFinished(WebView view, String url) {
Log.i(TAG, "Finished loading URL: " + url);
}
@Override
public void onReceivedError(WebView view, int errorCode,
String description, String failingUrl) {
Log.e(TAG, "Error: " + description);
}
@Override
public void onReceivedSslError(WebView view,
SslErrorHandler handler, SslError error) {
Log.i(TAG, "ssl error:" + error);
handler.proceed();
}
});
Upvotes: 1
Views: 216
Reputation: 6778
Webview.getSettings().setUserAgentString(<Set the Browser NameString>);
The above setting might help you. It might be the case that userAgentString
will set the browser type as well
Upvotes: 1