Questions tagged [android-webview]

Part of the Android API. A View that displays web pages. This class is the basis upon which you can roll your own web browser or simply display some online content within your Activity.

android-webview
Filter by
Sorted by
Tagged with
288 votes
8 answers
352k views

Android Calling JavaScript functions in WebView

I am trying to call some javascript functions sitting in an html page running inside an android webview. Pretty simple what the code tries to do below - from the android app, call a javascript ...
user163757's user avatar
  • 6,925
403 votes
18 answers
324k views

How to go back to previous page if back button is pressed in WebView?

I have an app in which I have a WebView where I display some websites. It works, clicking a link in the webpage goes to the next page in the website inside my app. But when I click the phone's back ...
zvzej's user avatar
  • 6,286
506 votes
18 answers
428k views

How to listen for a WebView finishing loading a URL?

I have a WebView that is loading a page from the Internet. I want to show a ProgressBar until the loading is complete. How do I listen for the completion of page loading of a WebView?
Janusz's user avatar
  • 188k
125 votes
13 answers
152k views

WebView and HTML5 <video>

I'm piecing together a cheapo app that amongst other things "frames" some of our websites... Pretty simple with the WebViewClient. until I hit the video. The video is done as HTML5 elements, and ...
brian moore's user avatar
  • 1,263
92 votes
7 answers
121k views

How do I get the web page contents from a WebView?

On Android, I have a WebView that is displaying a page. How do I get the page source without requesting the page again? It seems WebView should have some kind of getPageSource() method that returns ...
gregm's user avatar
  • 12.1k
106 votes
9 answers
178k views

Playing HTML5 video on fullscreen in android webview

Well, I've been searching few days already, how to display HTML5 video in full-screen mode on android WebView. I managed to play HTML5 videos on my webview. Problems are arising when displaying video ...
nbtk's user avatar
  • 3,109
215 votes
6 answers
144k views

Clicking URLs opens default browser

I have loaded an external URL in my WebView. Now what I need is that when the user clicks on the links on the page loaded, it has to work like a normal browser and open the link in the same WebView. ...
JaVadid's user avatar
  • 7,107
534 votes
11 answers
233k views

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 ...
Ray's user avatar
  • 16.2k
42 votes
10 answers
55k views

WebView android proxy

I know how to setting proxy manually and to use it in my WebView. Settings -> Wireless Networks ->mobile networks-> access point names->telkila. Now enter the proxy server address and port (which ...
user430926's user avatar
  • 4,027
74 votes
11 answers
142k views

How can I get onclick event on webview in android?

I want to know when the user clicks on webview but not on a hyperlink. On that click I want to show/hide a view of my activity that holds a webview. Any suggestion?
Arslan Anwar's user avatar
  • 18.7k
79 votes
3 answers
75k views

Call Java function from JavaScript over Android WebView

I want to make a synchronous call to some Java code in my Android app. I am using this solution: https://stackoverflow.com/a/3338656 My Java code: final class MyWebChromeClient extends ...
ozkolonur's user avatar
  • 1,460
76 votes
8 answers
69k views

WebView: how to avoid security alert from Google Play upon implementation of onReceivedSslError

I have a link which will open in WebView. The problem is it cannot be open until I override onReceivedSslError like this: @Override public void onReceivedSslError(WebView view, SslErrorHandler handler,...
captaindroid's user avatar
  • 2,908
90 votes
13 answers
162k views

Disable scrolling in webview?

Until now I have been an iPhone developer only and now I have decided to give Android a whirl. Something I haven't been able to figure out on Android is how to programmatically prevent scrolling in a ...
Jake Sankey's user avatar
  • 5,067
206 votes
6 answers
214k views

Load HTML file into WebView

I have a local html page along with several other resources pointed by it (css files and Javascript libraries) that I would like to load into a WebView . How could this be achieved ? Perhaps not the ...
klaus johan's user avatar
  • 4,390
129 votes
13 answers
180k views

Add custom headers to WebView resource requests - android

I need to add custom headers to EVERY request coming from the WebView. I know loadURL has the parameter for extraHeaders, but those are only applied to the initial request. All subsequent requests ...
Ray's user avatar
  • 1,433
29 votes
4 answers
122k views

How to send data from one Fragment to another Fragment?

Hi I know there are answers of this question. I have tried all of them but it is not working in my app. I am developing an app that has 3 Fragment activity. First fragment shows a website, second ...
Muhidul Hassan's user avatar
131 votes
22 answers
286k views

Android Webview - Webpage should fit the device screen

I have tried the following to fit the webpage based on the device screen size. mWebview.setInitialScale(30); and then set the metadata viewport <meta name="viewport" content="width=320, initial-...
SWDeveloper's user avatar
  • 1,759
46 votes
11 answers
80k views

YouTube Video not playing in WebView - Android

I am tying to play YouTube video in WebView, WebView showing first look of video with play button, But after click on play button start progress bar and after 2-3 seconds stop progress bar and screen ...
Ranjitsingh Chandel's user avatar
33 votes
13 answers
74k views

Setting WebView to view Desktop Site and Not Mobile Site

I've done quite a lot of research on Stack Overflow and a lot of Google research but nothing I find is actually working out for me. I want the site to view the desktop site instead of the mobile site. ...
user2039764's user avatar
145 votes
9 answers
201k views

Android WebView, how to handle redirects in app instead of opening a browser

So right now in my app the URL I'm accessing has a redirect, and when this happens the WebView will open a new browser, instead of staying in my app. Is there a way I can change the settings so the ...
James's user avatar
  • 5,642
93 votes
6 answers
154k views

Loading existing .html file with android WebView

I did try samples, demos from Google codes and other resources with WebView, but when i try to do it in my own code, it doesn't work for me. I want to load myfile.html which i put in assets folder, ...
laph's user avatar
  • 2,925
77 votes
9 answers
71k views

Memory leak in WebView

I have an activity using an xml layout where a WebView is embedded. I am not using the WebView in my activity code at all, all it does is sitting there in my xml layout and being visible. Now, when I ...
Mathias Conradt's user avatar
109 votes
17 answers
191k views

Android WebView not loading an HTTPS URL

public void onCreate(Bundle savedInstance) { super.onCreate(savedInstance); setContentView(R.layout.show_voucher); webView=(WebView)findViewById(R.id.webview); webView....
sumit's user avatar
  • 1,091
61 votes
11 answers
94k views

Android - local image in webview

I'm trying to diplay a local image in my webview : String data = "<body>" + "<img src=\"file:///android_asset/large_image.png\"/></body>"; webview.loadData(data, "text/html", "UTF-...
Stéphane Piette's user avatar
297 votes
8 answers
184k views

Android webview & localStorage

I have a problem with a webview which may access to the localStorage by an HTML5 app. The test.html file informs me that local storage is'nt supported by my browser (ie. the webview). If you have any ...
Thomas's user avatar
  • 9,399
134 votes
7 answers
145k views

WebView link click open default browser

Right now I have an app that loads a webview and all the clicks are kept within the app. What I would like to do is when a certain link, for example, http://www.google.com is clicked within the app it ...
Kyle's user avatar
  • 1,629
83 votes
13 answers
24k views

Android - WebView language changes abruptly on Android 7.0 and above

I have a multilingual app with primary language English and secondary language Arabic. As described in the documentation, I have added android:supportsRtl="true" in the manifest. I have changed all ...
Yash Sampat's user avatar
  • 30.3k
66 votes
8 answers
138k views

enable/disable zoom in Android WebView

There are some methods in WebSettings related to zoom: WebSettings.setSupportZoom WebSettings.setBuiltInZoomControls I noticed they work differently on some devices. For example, on my Galaxy S ...
Eugene Nacu's user avatar
  • 1,633
28 votes
2 answers
10k views

How to handle RTL languages on pre 4.2 versions of Android?

Background TextView always had issues with RTL (Right-To-Left) languages. Since I know only how to read Hebrew (in addition to English), I will talk about its issues: Text alignment (and I'm not ...
android developer's user avatar
136 votes
15 answers
309k views

How to load external webpage in WebView

My problem is that the webpage is not loaded inside the WebView. mWebview.loadUrl("http://www.google.com"); launches the web browser... This is the code of my activity: import android.app....
Gilbou's user avatar
  • 5,254
77 votes
11 answers
81k views

Android WebView "tel:" links show web page not found

I am trying to get my android webview app to open tel: links to the phone. Every time I open up a telephone link it works great and opens up the phone. However once I am done with my call and go ...
Jeff Thomas's user avatar
  • 4,808
20 votes
2 answers
48k views

Download Blob file from Website inside Android WebViewClient

I have an HTML Web page with a button that triggers a POST request when the user clicks on. When the request is done, the following code is fired: window.open(fileUrl); Everything works great in the ...
Jonathan Brizio's user avatar
107 votes
12 answers
84k views

Android - Preventing WebView reload on Rotate

When I rotate my screen, the WebView reloads the whole page. I can't have this since some of my content contains dynamic/random material. Currently when rotated the screen reloads the original URL ...
mark's user avatar
  • 2,871
79 votes
5 answers
98k views

Android - extracting cookies after login in webview

I have an application that opens a url in a webview, the user must then login to a site through the webview and receives a cookie once logged in. I'm having problems getting cookies after login. The ...
elgoog's user avatar
  • 1,041
36 votes
14 answers
45k views

How to add "Go Back" function in WebView inside Fragment?

UPDATE: Solved! Problem was related to my Viewpager not WebView. I'm trying to add a "Go Back" function to my WebView which is inside a Fragment. But I can't figure out how to: public final class ...
Markus Rubey's user avatar
  • 5,203
31 votes
6 answers
74k views

Passing data from java class to Web View html

I'm loading below html in my webView https://mail-attachment.googleusercontent.com/attachment/?ui=2&ik=25c0c425c6&view=att&th=138db54ff27ad34b&attid=0.1&disp=inline&realattid=...
User's user avatar
  • 453
29 votes
10 answers
30k views

Android: Using WebView outside an Activity context

I am trying to achieve Web Scraping through a background IntentService that periodically scrape a website without a view displaying on the users phone. Since I have to do call some javascript on ...
Pierre's user avatar
  • 1,627
15 votes
2 answers
8k views

Send Post request along with HttpHeaders on Android

I need to post data to server (with "referer" header field) and load the response in Webview. Now, there are different methods (from Android WebView) to do parts of it, like there is: void loadUrl(...
Atul Goyal's user avatar
  • 3,531
13 votes
9 answers
49k views

Loading Youtube video through iframe in Android webview

I want to load youtube video to Android webview using iframe here is my layout Xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android....
edwin's user avatar
  • 8,073
173 votes
5 answers
137k views

Is `shouldOverrideUrlLoading` really deprecated? What can I use instead?

Is "shouldOverrideUrlLoading" really deprecated? If so, what can I use instead? It seems like shouldOverrideUrlLoading is deprecated targeting Android N and I need to make an app work since API 19 ...
Minion's user avatar
  • 2,527
77 votes
6 answers
138k views

How does evaluateJavascript work?

I'm trying to use the new evaluateJavascript method in Android 4.4, but all I ever get back is a null result: webView1.evaluateJavascript("return \"test\";", new ValueCallback<String>() { @...
CodingIntrigue's user avatar
41 votes
5 answers
55k views

How to change the FontSize in an Android WebView?

How can you manually change the font size of a webview? e.g. When the page loads up in the webview the font size is like 24pt. and way too large for my android's screen. I've looked into the "...
Scott's user avatar
  • 1,501
33 votes
5 answers
88k views

Upload an Image from camera or gallery in WebView

WebView in this app opens a page with upload button. Below is the code block that allows to open a dialog box to upload image from gallery or camera. Within my Activity I have: private WebView wv; ...
Chirag's user avatar
  • 1,199
4 votes
2 answers
39k views

How to play a video in a webview with android?

I loaded a local html in sdcard, and in this html I used tag : <video id="myvideo" controls width="120" height="60" poster="img/img01.jpg" src="video/01.mp4"></video> and then I found ...
jin's user avatar
  • 2,135
222 votes
2 answers
358k views

WebView showing ERR_CLEARTEXT_NOT_PERMITTED although site is HTTPS [duplicate]

I'm starting to work on an app on Android, so I don't have much. All I have is just a WebView so far. I created the project in Android Studio, and my project got set as an Android InstantApp. I'm not ...
tylerr147's user avatar
  • 2,689
57 votes
4 answers
71k views

android: webview inside dialog or popup

how to add web view inside dialog or popup window. my web view hold URL WebView.loadurl() .when view added inside dialog it still moving to the browser. I've been in android loading webview in ...
roy.d's user avatar
  • 1,029
80 votes
9 answers
118k views

How to set the initial zoom/width for a webview

I am trying to get the WebView to have similar behavior as the android browser. The browser opens all pages in a way that tries to fit their width to the screen. However, the default behavior of the ...
cottonBallPaws's user avatar
72 votes
8 answers
100k views

How can I know that my WebView is loaded 100%?

I'm trying to load in my WebView some HTML code that contains JavaScript. Now , I want to test if my WebView is loaded before 5 secondes. I've tried the method getProgress(), but sometimes I get that ...
Houcine's user avatar
  • 24.1k
62 votes
7 answers
140k views

Add a Progress Bar in WebView

I am trying to add a progress/loading bar to my application that uses WebView. I am confused on how to implement a progress bar that appears every time a link is clicked. Current code: public class ...
Sean's user avatar
  • 877
40 votes
3 answers
79k views

Android webview loading data performance very slow

Hi I am working on one application, In that I am using Android WebView. Whenever I launch webview activity, loading data in string html format from test.txt file. test.txt file contains nearly 2.5 MB ...
Android learner's user avatar

1
2 3 4 5
20