webviewclient

Android - Open target _blank links in WebView with external browser

假如想象 提交于 2019-12-17 10:38:06
问题 I build a WebView which displays a website. The website contains links without a target="_blank" attribute and some with it. I need to open the links with target defined in the external standard device browser and the ones without it inside the WebView. I'm using a WebViewClient and I tried around with this function but still all my links are opened within the WebView : Alternative 1: @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { return super

Android 4.4 giving ERR_CACHE_MISS error in onReceivedError for WebView back

大憨熊 提交于 2019-12-17 07:22:04
问题 I have a webview in my Layout. By default, a search form is opened in it. On search, a listing section appears below the search form. If any link in the list is clicked, the details page opened. Now I want to controlled the back navigation for the webview. I placed this code in Activity. @Override public boolean onKeyDown(int keyCode, KeyEvent event) { Log.d("TYPE", TYPE); WebView myWebView = null; if (TYPE.equalsIgnoreCase("REPORT_ACTIVITY")) myWebView = reportView; if (TYPE.equalsIgnoreCase

Android WebView loading GoogleMap Data Rendering

眉间皱痕 提交于 2019-12-13 15:26:10
问题 I'm trying to display the div inside the WebView using the follwoing function String baseUrl = ""; String mimeType = "text/html"; String encoding = "UTF-8"; html = sb.toString(); String historyUrl = ""; webViewDataViewer.loadDataWithBaseURL(baseUrl, html, mimeType, encoding, historyUrl); here is my html : "<html> "+ " <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />" + " <head> <body> " + " <script type='text/javascript' src='http://maps.googleapis

Android WebView get raw cookie information

不想你离开。 提交于 2019-12-13 12:30:43
问题 I try to get cookie information with CookieManager in Android WebView. However, all it does is providing a key value pair of cookies, no additional information. I also tried this post and use connection.getHeaderFields.get("Set-Cookie"); to get all cookies received from server. But from what I can tell, I don't see all cookies that I am supposed to receive from server. This can also be found by some cookies in CookieManger receive a new value but not show in Set-Cookie field. Ideally, I would

Android webview javascript not working on API 18 or higher

余生颓废 提交于 2019-12-13 10:32:06
问题 I want to display a website in WebView with manipulating some DOM element. I mean, I want to remove a special div element or replace it with something. For this purpose I did something like this: For replacing something I use this model document.getElementById("demo").innerHTML = "Hello World!"; I apply it for Android WebView like this: public class WebClient extends WebViewClient { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; }

System Crash When Overriding shouldInterceptRequest in WebViewClient

↘锁芯ラ 提交于 2019-12-12 09:29:19
问题 Goal: Override all requests made by a WebView and make the request myself (eventually set up a proxy). Code: @Override public WebResourceResponse shouldInterceptRequest(WebView view, String url) { if (url == null || url.trim().equals("")) return null; final DefaultHttpClient httpClient = new DefaultHttpClient(); httpClient.getConnectionManager().closeExpiredConnections(); final HttpUriRequest httpRequest = new HttpGet(url); try { final HttpResponse response = httpClient.execute(httpRequest);

Android WebView : Why I can not able to redirect to play store from WebView?

♀尐吖头ヾ 提交于 2019-12-11 09:06:36
问题 I am trying to pass url to webview that should redirect to play store but Its not working. What I tried : String url = "https://play.google.com/store/apps/details?id=com.matchify"; webView.loadUrl(url); but its loading only inside the webview, how can I solve this? Thanks in advance 回答1: To open your app's / any other app's page on play store app use : startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackName))); Where appPackName is: String appPackName =

Open Soundcloud URL in native Soundcloud app from WebView

柔情痞子 提交于 2019-12-10 17:32:59
问题 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 intent://tracks:257659076#Intent;scheme=soundcloud;package=com.soundcloud.android;end Code My WebView uses a custom WebViewClient (because I need to intercept some URLs for some different stuff). protected class WebViewClient extends android.webkit.WebViewClient { public

Log <GATE-M>DEV_ACTION_COMPLETED</GATE-M> seems to delay execution on Android

半腔热情 提交于 2019-12-07 03:29:14
问题 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) view.findViewById(R.id.WebView); webView.setWebViewClient(new WebViewClient() { @Override public void onPageStarted(WebView view, String url, Bitmap favicon) { logDebug("Loading URL: " + url); super.onPageStarted(view, url, favicon); } @Override public boolean

WebViewClient returning “Couldn't establish a secure connection.” upon recreating the fragment

谁都会走 提交于 2019-12-06 23:55:34
问题 Our application has tabs and one of the fragments can contain a webviewclient. Users are now reporting an issue where the webviewclient is unable to load the page. We've confirmed that the server is up and running, we've also identified that the issue happens in v4.3 and all earlier versions. We have also confirmed that it works fine in v5.0; right now we've not been able to test whether it works in 4.4 or not (I guess that information only helps if someone knows of a change that occurred in