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

getting webViewClient.shouldInterceptRequest() on android 2.x

I am overriding webViewClient.shouldInterceptRequest() to return common resources like images and js files from asset folder.But this is available for android >=3 .is there any alternative to use for android 2.x I found onLoadResource() to provide…
vishesh
  • 2,007
  • 6
  • 32
  • 67
5
votes
2 answers

Android - Check if request is GET or POST

I need to check if the request is a POST or a GET in shouldInterceptRequest in my Android application. See code below: public class CustomWebViewClient extends WebViewClient { ... @Override public WebResourceResponse…
MartinR
  • 545
  • 1
  • 9
  • 16
4
votes
1 answer

shouldOverrideUrlLoading gets called ONLY for SOME webpages

I'm using the method shouldOverrideUrlLoading for an app that is personalised for multiple clients. Each client has it's own webpage that wants to be loaded into the webview. My problem is this: the app works perfect for client A and his webpage,…
philtz
  • 227
  • 6
  • 14
4
votes
0 answers

Why do some websites never deliver WebViewClient.onPageFinished()?

I can understand how some sites can deliver multiple WebViewClient.onPageFinished() per page, due to having multiple iframes in that page, or having to go through multiple redirects to reach that page. But some sites keep loading and loading...…
uTubeFan
  • 6,664
  • 12
  • 41
  • 65
4
votes
0 answers

Webview's saveState doesn't handle custom WebViewClient

Scope Have to handle orientation changes for WebView. Problem saveState/restoreState doesn't work for WebView when using custom WebViewClient (blank page is shown). Code snippet setContentView(R.layout.webview); // load OAuth url in…
Oleksii Malovanyi
  • 6,780
  • 6
  • 24
  • 27
4
votes
2 answers

App crash after reloading url inside webview

I have an app which contain WebView. On app laucnh webview loading url (html5 game). Also i have a button which reloading this url. And after i click it app crash with this error /com.i.demogame A/libc: Fatal signal 5 (SIGTRAP), code 1 in tid 5151…
Roman
  • 803
  • 2
  • 10
  • 17
4
votes
2 answers

Android WebViewClient callbacks called too often

When I call WebView#loadUrl I expect that I should only get a single WebViewClient#onPageFinished call and no WebViewClient#shouldOverrideUrlLoading call. However, I get a WebViewClient#shouldOverrideUrlLoading (which I implement by always calling…
Heath Borders
  • 30,998
  • 16
  • 147
  • 256
4
votes
0 answers

Android WebView with AngularJS application route changes not being detected in shouldOverrideUrlLoading

I have been working on a hybrid android application. Currently a WebView in our application is pointing to an AngularJS 1.5.7 application. When the user hits a button inside of the application that changes the route I was expecting the…
4
votes
2 answers

How to detect when redirects in WebView finish?

I have gone through every related post I found here and still can't get it to work. I'm opening my WebView with a URL that has redirects (sometimes many redirects) and I want to know when the loading is really finished (URL finished loading with no…
Guy S
  • 1,424
  • 1
  • 15
  • 34
4
votes
0 answers

How to get .m3u8 link from embed link using a webview

I am a new to Android development and I want to get .m3u8 link from embedded link of dailymotion, yet I am using a webview client but I don't how it possible. My code is: public class WebViewActivity extends Activity implements DownloadListener { …
4
votes
4 answers

can't open file chooser in WebView Android 4.4.2 using WebChromeClient

In my webview by clicking "Choose File" button In samsung 7 inch tablet I want to open a File Browser, but I can't open this in Android Version 4.4.2. So can u plz help me for this? Here is my Code. WebViewDemo.java package…
4
votes
0 answers

Android's webviewclient onPageFinished() not fired on certain page.

In my android app, a web view wraps a mobile website. As a user browsers the mobile website I would like to show/hide back and/or forward arrow to assist his/her navigation. To determine show hide back and forward arrows I check webview canGoBack()…
Josh
  • 41
  • 4
4
votes
2 answers

Listen for URL fragment id change in WebView

It seems that the WebViewClient methods such as shouldInterceptRequest(), onPageStarted(), and shouldOverrideUrlLoading() only listen for URL changes that cause the WebView to load a new page. Is there a way to detect URL changes for fragment IDs,…
jpetitto
  • 331
  • 4
  • 15
4
votes
2 answers

How to add custom error page when there is no internet connection available

how can add my own error page replacing default error page "webpage not available" when there no internet connection available. like below image https://i.stack.imgur.com/OgS7o.jpg
Vinod
  • 95
  • 1
  • 11
4
votes
2 answers

Android passing touch event to WebView's inner content

I have a webview that I'm setting an onTouchListener on in order to capture swipe events on the actual view. I also set a WebViewClient on the WebView in order to override Url Loading when clicking on certain links inside the webview. The problem…
pat
  • 1,005
  • 4
  • 12
  • 29