webview

How to make Android webview remember username and password?

那年仲夏 提交于 2020-01-11 09:08:34
问题 Here with the code in Android Studio. I also add the html code that below the Android Studio code, using javascript to remember the username and password in cookies. It works in some android device only. I don'y know why. I would like to make it works for all the android device. Hope it will be a simple way to do it. Please kindly help. I want the user typed in his username/password one time, it should be filled out on next visit. public class MainActivity extends AppCompatActivity { private

Increase the size of the WebSQL quota in a WebView

拜拜、爱过 提交于 2020-01-11 08:59:35
问题 In a normal Android web app the maximum size for a WebSQL database is normally around 8MB. In a hybrid web app I am making I would like to increase this limit. How would I go about doing that? It seems that WebStorage might have something to do with it, but the only method I can see there that seems to set the size, setQuotaForOrigin , is marked deprecated . Sample code (that is not deprecated) is welcome :) 回答1: The quota for a web app seems to differ from that of a hybrid app (as in

Asynchronous JavaScript calls from Android WebView

喜欢而已 提交于 2020-01-11 04:52:04
问题 I'm building hybrid Android app with WebView that communicates with the device with JavaScriptInterface annotation From the WebView: webView.addJavascriptInterface(someService, "someService"); The service implementation: @JavascriptInterface public void someMethod() { //do some business logic.. } Problem is that from the JavaScript I run it like this: function callSomeMethod() { someService.someMethod() }; This call is synchronous, and would like something that will run asynchronously like:

How to pass JSON-formatted data from a WebView to a HTML page

自闭症网瘾萝莉.ら 提交于 2020-01-11 04:49:09
问题 I am trying to pass JSON-formatted data from my Android WebView to a HTML page. However, the app crashes whenever I try to parse the original JSON data, which I am expecting to be of the format {"key":"data"} The aim of my app will be to interpret this JSON data, form it into an array of values, and send it to a HTML page. Is this the correct approach to take? Here is my WebView code... public class MyWebView extends Activity { WebView mWebView; public void onCreate(Bundle savedInstanceState)

How to append additional text with existing html content in android?

烂漫一生 提交于 2020-01-11 04:14:13
问题 I am Developing an application.In which i am appending a text to existing text which is stored in .html file, the location for the .html file is in my application's "assets" folder. I know how to load html with URL but my problem is to append the text. following is my java code public class LoadWeb extends Activity { WebView wv; private Handler handler = null; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate

android WebView总结

一世执手 提交于 2020-01-11 03:39:28
浏览器控件是每一个开发环境都具备的,这为马甲神功提供了用武之地, windows 的有 webbrowser , android 和 ios 都有 webview 。仅仅是其引擎不同,相对于微软的 webbrowser , android 及 ios 的 webview 的引擎都是 webkit ,对 Html5 提供支持。本篇主要介绍 android 的 webview 之强大。 A. webview 组件怎样使用 1) 加入权限: AndroidManifest.xml 中必须使用许可 "android.permission.INTERNET", 否则会出 Web page not available 错误。 2) 在要 Activity 中生成一个 WebView 组件: WebView webView = new WebView(this); 或者能够在 activity 的 layout 文件中加入 webview 控件: < WebView android:id = "@+id/wv" android:layout_width = "fill_parent" android:layout_height = "fill_parent" android:text = "@string/hello" /> 3) 设置 WebView 基本信息: 假设訪问的页面中有

Video from local storage not playing in WebView (Xamarin.Forms) after latest iOS update (12.2)

筅森魡賤 提交于 2020-01-11 02:40:50
问题 I have an existing Xamarin Forms application, for Android and iOS, which shows some HTML content from local storage (the purpose is to view this content while offline) in WebView. After the latest iOS update (12.2), the videos in that HTML stopped working. White background is shown on the place of the video, with the symbol "Play" but no action is possible. I have tried changing the video tag to include autoplay, mute, but no success. <video width="560" height="315" controls> <source src=

Android中Java和JavaScript交互

时光总嘲笑我的痴心妄想 提交于 2020-01-11 00:15:55
webView.addJavaScriptInterface(new Object(){xxx}, "xxx"); 1 答案:可以使用WebView控件执行JavaScript脚本,并且可以在JavaScript中执行Java代码。要想让WebView控件执行JavaScript,需要调用WebSettings.setJavaScriptEnabled方法,代码如下: WebView webView = (WebView)findViewById(R.id.webview); WebSettings webSettings = webView.getSettings(); //设置WebView支持JavaScript webSettings.setJavaScriptEnabled(true); webView.setWebChromeClient(new WebChromeClient()); JavaScript调用Java方法需要使用WebView.addJavascriptInterface方法设置JavaScript调用的Java方法,代码如下: webView.addJavascriptInterface(new Object() { //JavaScript调用的方法 public String process(String value) { //处理代码

iOS 中通常加载 HTML 字符串

情到浓时终转凉″ 提交于 2020-01-10 19:43:08
有时候后台会返回多行文字,其中文字中某写大小,颜色需要特殊订制就会比较麻烦,会用HTML 字符串返回给前台。 假如后台返回的是responseData[@" activityMsg "] 这个,长这样 activityMsg = "<head> <meta charset="UTF-8"> </head> <div style="padding: 0px 0px;"> <p align="left" style="color: #990035;font-size: 13px; padding:0;margin:0">1.本次交易仅支持 信用卡,光大银行手机信用卡</p> <p align="left" style="color: #990035;font-size: 13px; padding:0;margin:0">2.光大联名信用卡最高满5000元减300元</p> <p align="left" style="color: #990035;font-size: 13px; padding:0;margin:0">3.使用银行卡满减权益的订单不支持退款</p> </div>" 1,通过 UILabel 加载富文本的方法加载 HTML 字符串 NSString* str1 = [self htmlEntityDecode:responseData[@"content"]]; /

How to force WebView to skip images?

不问归期 提交于 2020-01-10 18:43:27
问题 Can someone advice me how to tune up Android WebView to skip images from remote server (without image placeholders) 回答1: Try using : webView.getSettings().setLoadsImagesAutomatically(false); 回答2: webView.getSettings().setLoadsImagesAutomatically(false); webView.getSettings().setBlockNetworkLoads (true); 回答3: webView.getSettings().setBlockNetworkImage(true); and in webview onPageFinished webView.loadUrl("javascript:(function(){ var imgs=document.getElementsByTagName('img');"+ "for(i=0;i<imgs