1

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(); } }); 

1 Answer 1

1
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

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.