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
19
votes
3 answers

What is considered onPageFinished in the Android WebViewClient?

I am trying to perform an action on an Android WebView after my webpage finishes loading in it. I setup my WebView to have a WebViewClient to make use of the onPageFinished event callback. However, after some testing, it does't seem to wait until…
Steven
  • 905
  • 1
  • 8
  • 17
16
votes
7 answers

Open PDF in a WebView

I want to open a PDF in my WebView, and I found and combined codes on this forum. But it catches the "No PDF application found" although I have multiple PDF apps installed, including Adobe Reader. Here the code: private class PsvWebViewClient…
TheLD
  • 2,211
  • 4
  • 21
  • 26
16
votes
2 answers

Android webview get sslError SSL_UNTRUSTED but certificate is valid

I've implemented onReceivedSslError method in my WebViewClient to properly handle invalid https certificate in webview: @Override public void onReceivedSslError(WebView view, final SslErrorHandler handler, SslError error) { final…
andreaciri
  • 452
  • 5
  • 12
15
votes
2 answers

shouldOverrideUrlLoading does not work/catch link clicks while page is loading

I am using WebViewClient.shouldOverrideUrlLoading to catch any link clicks in the WebView. This works about 95% of the time, but sometimes it is simply not called. I have noticed it in these three circumstances: When the link points to the page…
cottonBallPaws
  • 21,220
  • 37
  • 123
  • 171
15
votes
5 answers

Disable Android WebView/WebViewClient Initiated favicon.ico Request

How can I disable the Android WebView/WebViewClient from sending out a request for favicon.ico when I call WebView.loadUrl()? I can see the call being made while profiling requests via CharlesProxy. I do not own the HTML content that I am displaying…
Travis Yim
  • 384
  • 3
  • 14
15
votes
5 answers

Android : EventHub.removeMessages(int what = 107) is not supported before the WebViewCore is set up

I have implemented WebView in Dialog Activity and I am loading simple url into webview. my Webview settings are as wbView = (WebView) findViewById(R.id.wbView); wbView.setKeepScreenOn(true); …
Vishal Khakhkhar
  • 2,106
  • 3
  • 29
  • 60
14
votes
6 answers

Android WebViewClient onReceivedError is not called for a 404 error

hi In a list view i have an webview which should load a image file from the server,when there is no image present i need a dummy image .I tried holder.image.setWebViewClient(new WebViewClient() { @Override public…
ganesh
  • 1,247
  • 6
  • 24
  • 46
14
votes
1 answer

What does stopLoading() really do?

Yes, I know the documentation for stopLoading() says "Stops the current load." But when I try to use it to stop loading currently progressing page before loading a new one, it doesn't seem to behave as desired: 07-24 12:53:30.177: V/WebView.loadUrl:…
scatmoi
  • 1,958
  • 4
  • 18
  • 32
13
votes
3 answers

WebViewClient.onPageStarted( ) called twice when specifying non-existent URL via WebView.loadURL()

Here is my code public class Main extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); WebView webView =…
13
votes
5 answers

How to get link-URL in Android WebView with HitTestResult for a linked image (and not the image-URL) with Longclick

I try to catch webview longclicks to show a context menu. (see code below) When longclicking an image, I always get the image-URL as extra (for a not linked image with IMAGE_TYPE and for a linked image with SRC_IMAGE_ANCHOR_TYPE). But how can I get…
Sebastian
  • 221
  • 1
  • 3
  • 9
11
votes
3 answers

Android-WebView's onReceivedHttpAuthRequest() not called again

I am using a webview based application where i am rendering a url in the webview. The Url has a HTTP auth . When i launch the url very first time,its onReceivedHttpAuthRequest() is called and I display a dialog for user to enter the authentication…
11
votes
1 answer

onPageFinished takes more than 2 minutes when URL accessed directly

On certain websites, I noticed that if I access an inner page directly (i.e. not by touching a link from a different page on the same website), onPageFinished() takes forever (i.e. 2 minutes and more!) to arrive. If I load that same page by touching…
WebViewer
  • 761
  • 7
  • 21
11
votes
3 answers

stop loading in webViewClient

In my WebView, I have multiple links in header. In Offline mode, I mustn't allow reload the page and keep that page as is and then, inform users about internet connection. I am able to catch links before it loads using shouldOverrideUrlLoading if I…
boburShox
  • 2,630
  • 5
  • 23
  • 35
10
votes
5 answers

onPageStart called many times and onPageFinished not called for single page

My question is different from this one guys.. I wany my progress dialog start when page load starts and end when the page load finished in my webview. My problem is the progress dialog starts and never get dismissed.I have set break points it shows…
Mahendran
  • 2,719
  • 5
  • 28
  • 50
10
votes
3 answers

How to detect errors only from the main page in new onReceivedError from WebViewClient

Context In the Android SDK 23 onReceivedError(WebView view, int errorCode, String description, String failingUrl) has been deprecated and replaced with onReceivedError(WebView view, WebResourceRequest request, WebResourceError error). However as per…
Gustavo Pagani
  • 6,583
  • 5
  • 40
  • 71
1
2
3
21 22