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
529
votes
11 answers

Android webview launches browser when calling loadurl

I created an Activity that has a title and a web view in a LinearLayout. In the onResume() method it calls webView.loadUrl(url). The problem is that the activity first shows the title with the rest of the screen blank, then the device browser is…
Ray
  • 16,025
  • 5
  • 31
  • 51
287
votes
4 answers

What's the difference between setWebViewClient vs. setWebChromeClient?

What's the difference between setWebViewClient vs. setWebChromeClient in Android?
Pentium10
  • 204,586
  • 122
  • 423
  • 502
85
votes
9 answers

Enabling general JavaScript in WebViewClient

While searching for an answer in google, it seems that I'm not the only one stuck with a problem that seems impossible to solve. I've managed to create a WebView with a custom WebViewClient - this makes it possible for me to have a processdialog and…
Repox
  • 15,015
  • 8
  • 54
  • 79
76
votes
2 answers

Are WebViewClient and WebChromeClient mutually exclusive?

From this great explanation about the differences between WebViewClient and WebChromeClient it seems that if you use one, you shouldn't be using the other (for the same WebView object). Is my understanding correct? If not, when would one use both…
ef2011
  • 10,431
  • 12
  • 49
  • 67
72
votes
7 answers

Intercept and override HTTP requests from WebView

I have a WebView in my application in which some site is opened (always the same, it is my own page). The site has some JS code that loads some images from the remote host. I want to intercept requests to such images (by URL pattern) and give back…
Olegas
  • 10,349
  • 8
  • 51
  • 72
39
votes
5 answers

Android - Open target _blank links in WebView with external browser

I build a WebView which displays a website. The website contains links without a target="_blank" attribute and some with it. I need to open the links with target defined in the external standard device browser and the ones without it inside the…
Ron
  • 22,128
  • 31
  • 108
  • 206
33
votes
3 answers

Android - how to intercept a form POST in android WebViewClient on API level 4

I have a WebViewClient attached to my WebView like so: webView.setWebViewClient(new MyWebViewClient()); Here is my implementation of MyWebViewClient: private class MyWebViewClient extends WebViewClient { @Override public boolean…
manisha
  • 4,454
  • 2
  • 18
  • 10
31
votes
4 answers

Android 4.4 giving ERR_CACHE_MISS error in onReceivedError for WebView back

I have a webview in my Layout. By default, a search form is opened in it. On search, a listing section appears below the search form. If any link in the list is clicked, the details page opened. Now I want to controlled the back navigation for the…
dev_android
  • 8,698
  • 22
  • 91
  • 148
27
votes
4 answers

Enabling specific SSL protocols with Android WebViewClient

My application uses WebViewClient to make SSL connections to the server. The server is configured to only accept TLSv1.1 and above protocols. How do I check which SSL protocols are a) Supported and b) Enabled by default when using Android…
user802467
  • 951
  • 2
  • 14
  • 22
24
votes
15 answers

WebView loadUrl works only once

EDIT: I worked on this project years ago and unfortunately I cannot verify if any of the answers is working in the given scenario. I am having hard time with one WebView which should show our blog. When initilized, it works just fine. The user can…
Elena
  • 657
  • 1
  • 7
  • 22
23
votes
1 answer

System Crash When Overriding shouldInterceptRequest in WebViewClient

Goal: Override all requests made by a WebView and make the request myself (eventually set up a proxy). Code: @Override public WebResourceResponse shouldInterceptRequest(WebView view, String url) { if (url == null || url.trim().equals("")) …
XtremeEmir
  • 231
  • 2
  • 5
22
votes
3 answers

shouldOverrideUrlLoading in WebView for Android not running

-Edit: Solution Found- Figured it out after some heavy searching - one person (I literally mean one) said they instead used onPageLoad(); which worked perfectly for my purposes. The difference is that onPageLoad() runs later than…
Justin
  • 223
  • 1
  • 2
  • 5
21
votes
2 answers

WebView Crash by java.io.IOException: close failed: EIO (I/O error) libcore.io.IoUtils.close(IoUtils.java:41)

i've got a crash log upload by users on Android 4.0/4.1,but i cant reproduce it.the log is like this: java.io.IOException: close failed: EIO (I/O…
River
  • 211
  • 1
  • 4
20
votes
4 answers

Android WebView for Facebook Like Button

I'm trying to make facebook like functionality in Android WebView (project specification does not allow browser opening, or any out of application activity). So, restrictions are that it has to be done in WebView. I've managed to make it a dialog,…
Stefan
  • 335
  • 1
  • 3
  • 6
20
votes
3 answers

Check in the onReceivedSslError() method of a WebViewClient if a certificate is signed from a specific self-signed CA

I would like to override the onReceivedSslError() of a WebViewClient. Here I want to check if the error.getCertificate() certificate is signed from a self-signed CA and, only in this case, call the handler.proceed(). In pseudo-code: @Override public…
Dev
  • 7,027
  • 6
  • 37
  • 65
1
2 3
21 22