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
6
votes
1 answer

Android WebView: Intercept redirect requests?

Is there any way to intercept redirect requests in Android WebView? shouldInterceptRequest(WebView,WebResourceRequest) does not seem to get called! I wanted to automatically catch token expiration in all web view requests by: Issuing a redirect…
Jess Holle
  • 633
  • 5
  • 15
6
votes
1 answer

load WebView cached image into an ImageView

I have a WebView that caches its images into a directory using these settings: mWebView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK); mWebView.getSettings().setAppCacheMaxSize( 8 * 1024 * 1024 ); //…
dors
  • 5,802
  • 8
  • 45
  • 71
6
votes
1 answer

Log DEV_ACTION_COMPLETED seems to delay execution on Android

I've recently noticed that my app has the occasional LAG. and by LAG I mean it can take up to 40 seconds, depends if I use Wifi or mobile data... I load a page url, and then load js for execution: webView = (WebView)…
6
votes
2 answers

Android WebClient, returning an image resource through WebResourceResponse - not displaying image

I have a simple WebViewClient for my WebView and am overriding shouldInterceptRequest: (Not actual code) public class WebViewClientBook extends WebViewClient { @Override public WebResourceResponse shouldInterceptRequest(WebView view, String…
eugene
  • 83
  • 2
  • 6
6
votes
3 answers

proguard warning library class android.webkit.WebView depends on program class android.webkit.WebViewClien

I have a version of file android.webkit.WebViewClient in my application source directory in order to handle onReceivedSslError in my own extended version of WebViewClient. When I use the new ProGuard integration in sdk-7 I get the following…
user1318700
  • 63
  • 1
  • 1
  • 5
5
votes
1 answer

Webview - change page source before show website?

I have a website. On the Website, there is a text "Pic". When I show the website in the Webview for the first time I can change the text to "PicGreat". This works! But, later when a user clicks on a Link (somewhere on the website), then I forward…
user1205415
  • 605
  • 1
  • 7
  • 22
5
votes
3 answers

Getting blank page in Android WebViewClient

I am trying open twitter link : http://mobile.twitter.com/pawan_rathore88 in my activity. If I set WebViewClient to webview I am getting blank page. But when I load url without setting any webviewclient, it loads page properly. Does anyone have idea…
Pawan
  • 1,503
  • 2
  • 19
  • 28
5
votes
1 answer

Looking for Android ViewFlipper Example with Multiple WebViews

As I am sure you all know. Setting up a WebView is a matter of creating a webview browser client, setting properties and loading a resource into the browser client. I have created several android apps that do exactly that. What i would like to try…
jroot.zen
  • 231
  • 1
  • 3
  • 9
5
votes
2 answers

shouldOverrideUrlLoading(...) not executed if "window.location.href" modified in a timeout callback

I have a javascript function 'gotoMainPage()' function gotoMainPage( ) { window.location.href = "main/main.do"; } Now, WebViewClient's shouldOverrideUrlLoading(..) gets called if gotoMainPage( ) is executed as a result of a 'direct user…
5
votes
1 answer

Open Soundcloud URL in native Soundcloud app from WebView

Scenario I have a WebView in my Android app which contains a Soundcloud embed (from Embedly). This embed has two buttons: "Play on Soundcloud" and "Listen in browser". The "Play on Soundcloud" button contains a URL in format…
Glenn Porter
  • 536
  • 6
  • 18
5
votes
0 answers

Android WebViewClient onLoadResource() called agian after onPageFinished() when targetSdkVersion is 19

I've defined a CustomWebViewClient class that extends WebViewClient, and simply override onLoadResource() and onPageFinished() to control progressbar's visibility as follow: @Override public void onPageFinished(WebView view, String url) { …
tuoniuniu
  • 93
  • 6
5
votes
0 answers

WebView's onScaleChanged handler called multiple times

I have custom WebView class in which default zoomIn/zoomOut controls are disabled and I'm manually handling the zoom events. Also I have WebViewClient in which onScaleChanged() handler is overriden, it looks like this: mWebViewClient = new…
5
votes
1 answer

How to return Http error response from webViewClient.shouldInterceptRequest()?

I've override public WebResourceResponse shouldInterceptRequest(WebView webView, String url) and it should return custom response on request from Ajax function. But looks like WebResourceResponse contains only response body. How can I pass HTTP…
amukhachov
  • 5,822
  • 1
  • 41
  • 60
5
votes
3 answers

Android WebViewClient url redirection (Android URL loading system)

I was trying intercept webview request using: ShouldInterceptRequest, inside it I used HttpUrlConnection to fetch data from server, I set it to follow the redirection, which is transparent to webviewclient. This means when I return…
5
votes
0 answers

Get resource from WebView that has already been downloaded

I have a webview that loads an external web page. I want to implement a custom caching mechanism so there will be no need to download resources like css, js and images again. I have already tried those two methods: override the…
Kiril Aleksandrov
  • 2,601
  • 20
  • 27