Questions tagged [webview]
Elements in graphical user interfaces that host HTML content. For Android, look at the android-webview tag. For iOS, look under uiwebview or wkwebview. For VS Code, look under vscode-webview.
webview
22,629
questions
298
votes
8
answers
186k
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 ...
289
votes
8
answers
355k
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 ...
249
votes
7
answers
246k
views
Android Webview gives net::ERR_CACHE_MISS message
2023 Edit: This question was from 2015. You may be able to find more suitable answers elsewhere.
I built a web app and wants to create an android app that has a webview that shows my web app. After ...
220
votes
7
answers
153k
views
How to check if a file exists in Documents folder?
I have an application with In-App Purchase, that when the user buy something, download one html file into the Documents folder of my app.
Now I must check if this HTML file exists, so if true, load ...
211
votes
23
answers
301k
views
File Upload in WebView
I have been struggling to upload files from WebView. I googled and implemented all suggested solutions (e.g. this SO post), but none work.
I have an HTML page with the following code to upload a file.
...
190
votes
7
answers
393k
views
jQuery get the location of an element relative to window
Given an HTML DOM ID, how to get an element's position relative to the window in JavaScript/JQuery? This is not the same as relative to the document nor offset parent since the element may be inside ...
189
votes
11
answers
187k
views
Android webview slow
My android webviews are slow. This is on everything from phones to 3.0+ tablets with more than adequate specs
I know that webviews are supposed to be "limited" but I see web apps done with phone gap ...
185
votes
11
answers
155k
views
Swift Open Link in Safari
I am currently opening the link in my app in a WebView, but I'm looking for an option to open the link in Safari instead.
175
votes
6
answers
139k
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 ...
174
votes
23
answers
141k
views
Android WebView style background-color:transparent ignored on android 2.2
I'm struggling to create a WebView with transparent background.
webView.setBackgroundColor(0x00FFFFFF);
webView.setBackgroundDrawable(myDrawable);
Then I load a html page with
<body style="...
169
votes
5
answers
178k
views
How to pass html string to webview on android?
I am parsing xml and then loading it to web view. After parsing, I am creating four strings so that I could append all strings to one view. I am able to get two views on the web view, but not the ...
154
votes
20
answers
108k
views
Android WebView: handling orientation changes
The issue is the performance following rotation. The WebView has to reload the page, which can be a bit tedious.
What's the best way of handling an orientation change without reloading the page from ...
153
votes
6
answers
131k
views
How to enable zoom controls and pinch zoom in a WebView?
The default Browser app for Android shows zoom controls when you're scrolling and also allows for pinch zooming. How can I enable this feature for my own Webview?
I've tried:
webSettings....
152
votes
21
answers
53k
views
android.view.InflateException Error inflating class android.webkit.WebView
In Lollipop (API 22) every time in my application I show a webview the application crashes.
I have multiple crashes in my android developer console related to this event.
No need to say that it works ...
146
votes
13
answers
262k
views
how to get html content from a webview?
Which is the simplest method to get html code from a webview?
I have tried several methods from stackoverflow and google, but can't find an exact method. Please mention an exact way.
public class ...
145
votes
16
answers
231k
views
Android Webview - Completely Clear the Cache
I have a WebView in one of my Activities, and when it loads a webpage, the page gathers some background data from Facebook.
What I'm seeing though, is the page displayed in the application is the ...
141
votes
12
answers
278k
views
How can I display a pdf document into a Webview?
I want to display pdf contents on webview.
Here is my code:
WebView webview = new WebView(this);
setContentView(webview);
webview.getSettings().setJavaScriptEnabled(true);
webview.loadUrl("http://...
130
votes
22
answers
287k
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-...
130
votes
3
answers
14k
views
Cannot display HTML string
I am struggling with display string HTML in Android WebView.
On the server side, I downloaded a web page and escape HTML characters and quotes (I used Python):
my_string = html.escape(my_string, True)
...
125
votes
13
answers
153k
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 ...
124
votes
4
answers
42k
views
NameNotFoundException webview
I am getting errors from Crashlytics that indicates that some devices are missing com.google.android.webview. How is that even possible?
java.lang.RuntimeException: Unable to start activity ...
124
votes
1
answer
16k
views
dequeueBuffer: can't dequeue multiple buffers without setting the buffer count
I'm getting the error below on Android 4.4.2 Moto X 2013 in a Rhomobile 5.0.2 WebView app. The app is compiled with SDK 19 and minAPI 17.
After some research it seems that this is an issue with ...
112
votes
1
answer
50k
views
Android Webview: "Uncaught TypeError: Cannot read property 'getItem' of null"
I am creating a simple android app which has a webview which should display a url. When I give the url as google.com or facebook.com it loads properly but when I give my url(qbo.intuit.com), it doesn'...
111
votes
9
answers
158k
views
Android. WebView and loadData
It's possible to use following method for content's setting of a web-view
loadData(String data, String mimeType, String encoding)
How to handle the problem with unknown encoding of html data?!
Is ...
110
votes
17
answers
193k
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....
110
votes
8
answers
180k
views
How to force keyboard with numbers in mobile website in Android
I have a mobile website and it has some HTML input elements in it, like this:
<input type="text" name="txtAccessoryCost" size="6" />
I have embedded the site into a WebView for possible ...
109
votes
15
answers
119k
views
How to change font face of Webview in Android?
I want change the default font of webview to a custom font. I'm using webview in developing an bilingual browser app for Android.
I tried getting an instance of custom typeface by placing my custom ...
104
votes
6
answers
207k
views
Download file inside WebView
I have a webview in my Android Application. When user goes to webview and click a link to download a file nothing happens.
URL = "my url";
mWebView = (WebView) findViewById(R.id.webview);
mWebView....
103
votes
12
answers
123k
views
JavaScript not working in Android Webview?
I'm trying to make an Android version of a relativly simple iOS app that uses a webview, some buttons and then relies on javascript calls to a CMS.
But I'm stuck at a pretty early point of ...
103
votes
16
answers
109k
views
detect ipad/iphone webview via javascript
Is there a way to detect with JavaScript if the website runs inside the iPad's Safari or inside an application WebView?
98
votes
16
answers
180k
views
Why does Android WebView sporadically not sending my session cookie?
I have a server that sends my android app a session cookie to be used for authenticated communication. I am trying to load a WebView with a URL
pointing to that same server and I'm trying to pass in ...
91
votes
2
answers
4k
views
Favourite content is not shown correctly on webview
I'm developing a language dictionary app. I save the favourite word into Preference. The Favourite content in the XML file looks like the following:
<?xml version='1.0' encoding='utf-8' standalone=...
87
votes
9
answers
102k
views
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 ...
83
votes
7
answers
113k
views
Rendering HTML in a WebView with custom CSS
My app is using JSoup to download the HTML of a message board page (let's say in this case it is a page containing the posts of a given thread). I'd like to take this HTML, strip out unwanted items, ...
81
votes
3
answers
50k
views
What do setUseWideViewPort() and setLoadWithOverviewMode() precisely do?
I am disappointed at the lack of documentation of WebView and related stuff.
(unless you think the following is propert documetation)
public void setLoadWithOverviewMode
(boolean overview)
...
80
votes
9
answers
119k
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 ...
78
votes
9
answers
59k
views
Android WebView with garbled UTF-8 characters.
I'm using some webviews in my android app, but are unable to make them display in utf-8 encoding.
If use this one I won't see my scandinavian charcters:
mWebView.loadUrl("file:///android_asset/om....
78
votes
2
answers
65k
views
WebView load website when online, load local file when offline
I am actually new to programming in Java but I have been following several solutions to my problem here but didn't find one that suits my case and I can't seem to get the code down correctly.
I would ...
77
votes
9
answers
49k
views
Android activity as dialog, but without a title bar
I have an activity that has the following set as theme:
android:theme="@android:style/Theme.Dialog"
However, there is a title bar in the activity-dialog that appears, that uses up the little ...
77
votes
2
answers
85k
views
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 ...
76
votes
5
answers
148k
views
How to load html string in a webview?
i have a html string containing this:
<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">
<html>
<head>
<meta http-equiv="content-type" content="...
73
votes
1
answer
3k
views
ReferenceError getValuesOfAutofillInputs, Can't find variable: PaymentAutofillConfig [closed]
We are facing the Reference error in our code since 2nd of June 2022 on our sentry logs.
Moreover its only happening on iOS (iphone) devices only..
Please find the link below to see the error:
https://...
71
votes
8
answers
112k
views
Android WebView progress bar
I have looked at a question similar to this here but as I am a newbie could someone explain how to get this to work in a WebView or at least how to set a 10 second time delay so people know that it's ...
67
votes
18
answers
59k
views
How to stop youtube video playing in Android webview?
How can I stop a YouTube video which is played in my webview? When I click on the back button the video doesn't stop and instead continues in the background.
Code:
webView = (WebView) findViewById(R....
67
votes
9
answers
90k
views
Android WebView background color
I am adding to my layout a WebView to display justified text. I want to set the background of the WebView to be transparent to appear like a textView. Here's what I did:
WebView synopsis;
synopsis=(...
67
votes
1
answer
2k
views
Separate cookie jar per WebView in OS X
I've been trying to achieve the goal of having a unique (not shared) cookie jar per WebView in macOS (cookies management works different for iOS).
After reading a lot of StackOverflow questions and ...
66
votes
7
answers
69k
views
Android: Disable text selection in a webview
I am using a webview to present some formatted stuff in my app. For some interaction (which are specific to certain dom elements) I use javascript and WebView.addJavascriptInterface(). Now, I want to ...
64
votes
6
answers
51k
views
Make Android WebView not store cookies or passwords
I use an Android WebView for Twitter OAuth: Twitter asks the user to log in and authorize the application, I retrieve the access token and persist it in my application.
I have no need (and do not) ...
64
votes
1
answer
1k
views
AVD_loader.cpp: failed to get a service for display 4
I am trying to play audio through a WebView built which is built in Swift. Upon playing the audio, sometimes it will play out and other times it'll play for ~2 seconds and stop. I then get an error in ...
63
votes
5
answers
16k
views
Check if Android WebView is consuming touch events
TL;DR
How can I detect whether Android WebView consumed a touch event? onTouchEvent always returns true and WebViewClient's onUnhandledInputEvent is never triggered.
Detailed description
I have ...