Questions tagged [webviewclient]

An Android class to intercept load requests, key events, and other events.

An Android class that is attached to a Webkit Webview to intercept load requests, key events, and other events.

Documentation: https://developer.android.com/reference/android/webkit/WebViewClient.html

321 questions
10
votes
2 answers

Android - Use OkHttp with Webview

Is it possible to use okHttp as the webviewclient? ie mWebView.setWebViewClient(new OkHttpClient()); This gives me an error... The method setWebViewClient(WebViewClient) in the type WebView is not applicable for the arguments (OkHttpClient) Any…
Shmuel
  • 3,916
  • 2
  • 27
  • 45
10
votes
2 answers

Android JS in WebView.loadUrl()

I want to load a webpage in WebView but remove parts of the webpage. So, I created a custom WebViewClient. And, in onPageFinished(), I did some javascript to remove some elements. Then, I made the WebView visible. However, when I run it, it sets…
Eric Cochran
  • 8,414
  • 5
  • 50
  • 91
9
votes
3 answers

WebView - can't download file without requesting it twice?

If I listen with DownloadListener, I get the URL which I need to request after the browser already requested it. The browser already opened a connection to the URL (which is how it knows this is a download), why can't it pass me the connection? I…
Eli Revah
  • 3,626
  • 7
  • 27
  • 33
8
votes
1 answer

WebViewClient returning "Couldn't establish a secure connection." upon recreating the fragment

Our application has tabs and one of the fragments can contain a webviewclient. Users are now reporting an issue where the webviewclient is unable to load the page. We've confirmed that the server is up and running, we've also identified that the…
Paul Hadfield
  • 6,088
  • 2
  • 35
  • 56
8
votes
1 answer

Android WebView ignoring target="_blank" when added WebViewClient

I am facing a strange issue. In my application, I need to load a static html file based on clicked button in a WebView from assets folder. Now among 5 html files, one html file contains 15 static links. These links need to redirect user to the …
MysticMagicϡ
  • 28,593
  • 16
  • 73
  • 124
7
votes
1 answer

How do I use DownloadListener?

I am creating an app that allows college students to download their study material from within the app instead of the browser. The home page has lots of subject names. Each subject name leads to new webpage. So, I have used WebViewClient. But, at…
Paritosh Anand
  • 95
  • 1
  • 1
  • 4
7
votes
1 answer

Android WebView Protocol Handler

I am trying to develop an Android browser application using WebView which enables users to access content from a custom protocol. The custom protocol could be foobar:// I want to intercept all requests to this custom protocol. This means: GET…
7
votes
0 answers

Unable to get callback for HTTP 401 error using Webview android

I am using a Webview with WebViewClient to load a URL which requires authentication. I am using onReceivedHttpAuthRequest method of WebViewClient to set the authentication for every request. @Override public void…
Ajinkya678
  • 101
  • 1
  • 7
7
votes
1 answer

onRenderProcessGone(WebView view, RenderProcessGoneDetail detail) example

Below I posted my current onRenderProcessGone. In the if (!detail.didCrash()) {} the instance variable "view" is guaranteed to be null, it's safe to reinitialize it. Should I myself reinitialize it or system will do it? Could you specify the…
Alexander Savin
  • 1,952
  • 1
  • 15
  • 30
7
votes
1 answer

What is the difference b/w onReceivedHttpError and onReceivedError for WebView Client

I am trying to understand the difference b/w https://developer.android.com/reference/android/webkit/WebViewClient.html onRecievedHttpError and onRecievedError. For me I always get both of these callbacks for all errors in my webpage? Why we have two…
CommonMan
  • 3,868
  • 2
  • 24
  • 35
7
votes
3 answers

Upload camera photo and filechooser from webview INPUT field

My app is webbased and I need to upload pictures from an INPUT field camp. I've two situations and as i don't know another way to do it depending the page I'm choosing one or another with "boolean boolFileChoser" depending its URL petition: a. file…
Jordi
  • 616
  • 2
  • 9
  • 16
6
votes
4 answers

how to set different title for alert dialog when WebView page is loaded?

I want to set different title for alert dialog when WebView page is loaded but its not working. here is the code snippet: final AlertDialog.Builder alert = new AlertDialog.Builder( mContext); // alert.setTitle("Loading..."); final WebView wv…
user1087919
6
votes
0 answers

"Select certificate" dialog not showing in android webview

If I try to sign in to web-url via a Chrome / Microsoft Edge browser that has access to certificates on android device then everything works fine. Screen shot for the chrome/edge browser working: I try to sign in to web-url on android app using…
6
votes
0 answers

Android WebView get raw cookie information

I try to get cookie information with CookieManager in Android WebView. However, all it does is providing a key value pair of cookies, no additional information. I also tried this post and use connection.getHeaderFields.get("Set-Cookie"); to get all…
Yao
  • 709
  • 2
  • 11
  • 22
6
votes
1 answer

How to get WebviewClient instance from WebView not on API 26 in Android?

I'm working on an SDK for Android. As part of this SDK, I need to set my own WebViewClient to a WebView of an application where the WebView and the SDK are integrated (meaning not part of my SDK). For this reason, this WebView might have already…
Emil Adz
  • 40,709
  • 36
  • 140
  • 187
1 2
3
21 22