android-webview

Webview performance

…衆ロ難τιáo~ 提交于 2019-12-23 05:17:18
问题 I am rendering a webview on button click and am using the shouldInterceptRequest to intercept requests to resources like images, css and js files and serving them locally instead of over the network. I expected to see a considerable amount of difference in the load time but it reduced only by a small fraction. Is it possible to parallelize the shouldInterceptRequest ?Are there any other suggestions. Thanks in advance 回答1: The new Chromium WebView present in KitKat will read multiple

How to add JQuery (or any) js library into page loaded in Android WebView?

瘦欲@ 提交于 2019-12-23 04:21:00
问题 How to add JQuery library into page loaded in Android WebView? My WebView with page: webview.getSettings().setJavaScriptEnabled(true); webview.loadUrl(url); 回答1: I had to remove escapes from js code (like \n ). Also I had to wait untill JQuery is loaded: load.tryReady = function(time_elapsed) { // Continually polls to see if jQuery is loaded. if (typeof $ == "undefined") { // if jQuery isn't loaded yet... if (time_elapsed <= 5000) { // and we havn't given up trying... setTimeout("load

File upload popup not opening mono android xamarin

冷暖自知 提交于 2019-12-23 04:19:11
问题 I am using xamarin mono.android Version 4 with api level 19. I am trying below code for showing a website in webview my webpage has a upload file control but upload file is not working on that webpage page when opened using this app in webview. No popup appears when i click on file upload control in webview. Main Activity File Code using System; using Android.App; using Android.Content; using Android.Runtime; using Android.Views; using Android.Widget; using Android.OS; using Android.Webkit;

Android Webview application context

别等时光非礼了梦想. 提交于 2019-12-23 03:07:06
问题 I want to preload the web URL before activity launch. So can I instantiate the fragment under application context ? EDIT : - creating webview inside Application subclass and retrieving it in the activity .but unable to use it because of different contexts. < This happened if using support fragment library> - using service component to create webview and retrieving it in activity. same context issue as service is started under application context . < This happened if using support fragment

JavaScript Interface not working in my Android Application

冷暖自知 提交于 2019-12-23 02:57:23
问题 Following is my MainActivity class code public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // setContentView(R.layout.activity_main); WebView webView = new WebView(this); //add the JavaScriptInterface so that JavaScript is able to use LocalStorageJavaScriptInterface's methods when calling "LocalStorage" webView.addJavascriptInterface(new LocalStorageJavaScriptInterface(this), "LocalStorage");

Kitkat doesn't return url for requestFocusNodeHref

安稳与你 提交于 2019-12-23 02:56:08
问题 I have a long click listener attached to a webview, inside it I obtain the url associated to an img tag, everything works fine on 4.2.2 and 4.3 but now on 4.4 the message data url is identical to src 's value requestFocusNodeHref documentation Is this a bug? public class ImagePickerActivity extends Activity implements OnLongClickListener { ... ... @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_webview);

How can I change the “font-family” css style inside WebView after html is loaded

随声附和 提交于 2019-12-23 02:45:22
问题 I'm trying to change "font-family" with javascript injection. Here is my code. myWebView = (WebView) findViewById(R.id.webview); myWebView.getSettings().setJavaScriptEnabled(true); myWebView.getSettings().setBuiltInZoomControls(true); myWebView.setWebViewClient(new WebViewClient() { @Override public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); myWebView.loadUrl("javascript:(function(){ " + "css = '@font-face {font-family: \"myface\";src: url(\"file://

Unable to start a WebView from an AsyncTask

烂漫一生 提交于 2019-12-23 02:35:00
问题 I'd like to start a WebView from my AsyncTask but it doesn't seem to run. This is what my onPostExecute method looks like: public class Viewer extends AsyncTask<URI, Integer, URI> { private Activity objContext = null; public Viewer(Activity objContext) { this.objContext = objContext; } protected void onPostExecute(URI uriWebpage) { WebView wbvBrowser = new WebView(this.objContext); wbvBrowser.getSettings().setBuiltInZoomControls(true); wbvBrowser.getSettings().setJavaScriptEnabled(true);

Why doesn't WebViewClient.shouldInterceptRequest support redirects after 4.4?

情到浓时终转凉″ 提交于 2019-12-23 02:07:26
问题 I was trying to intercept all network communication going in and out of the WebView within the host application. My attempt focused around the two shouldInterceptRequest methods, provided by the WebViewClient: @Override public WebResourceResponse shouldInterceptRequest(final WebView view, String url) { Log.d(Constants.Tags.WEBVIEW_CLIENT, "WV REQUEST (OLD) " + url); return processRequest(url); } @Override @TargetApi(21) public WebResourceResponse shouldInterceptRequest(final WebView view,

Automatically login to Gmail using a WebView?

此生再无相见时 提交于 2019-12-22 22:08:22
问题 I'd like to use the user's Gmail username and password to automatically login to Gmail inside a WebView . Is there any existing code how to do this, as I'm having trouble with it (which hidden fields need to be posted, getting/re-injecting the cookie). I have tried to simply fill in the username/password-fields using JavaScript, which works, but on submitting the login-form (using JavaScript again), the WebView asks the users whether he/she wants the password to be saved, which I need to