webview

Filename are missing for openFileChooser Android 4.4.4

白昼怎懂夜的黑 提交于 2020-01-23 04:33:05
问题 Goal: to be able to attach a file of any type to a <input type="file" /> in a webview in Android 4.1+ . (Android 5+ is fine) I set openFileChooser as I saw fit based on few examples I have found. It works on 4.1 but not on 4.4.4 where the files attached do not have their filename correctly set . Instead is set as filename the last path of the intent.mData return to onActivityResult , .e.g, for a mData value of content://com.android.providers.downloads.documents/document/2 , the filename will

Android - playing html5 <video> in html code

北战南征 提交于 2020-01-23 04:01:05
问题 I know there are a lot of old discussion about this, but I am developing for new devices. I want to use WebView to show html5 video in video tag. I want to use this for android devices 4.0+ or even 4.1+. I do not want to change the WebView code a lot. Is it possible to show movie in WebView without opening some new views on top? Because most of the answers opened new view to play video? I need easy solution with as less as possible code corrections. Any code or tutorial will be welcome.

Android Webview becomes slow after a certain Exception

空扰寡人 提交于 2020-01-23 03:24:05
问题 After the exception (listed below) occures the Android Webview becomes noticeably slower. Every action within the webview takes five to ten seconds longer to load. The exception randomly happens after reloading a webview. Sometimes it happens after a few reloads and sometimes it takes up to 400 reloads to occur. It only happens on a webview that opens multiple websockets and it has to be tied to the Chrome engine 78.0.3904 and newer Chrome engines since I couldn't reproduce this Exception on

How can I force a webview app to open links in it instead of open them in the default android browser depending on the domain?

醉酒当歌 提交于 2020-01-23 02:51:06
问题 I've just begun developing android apps, so I need some help with my webview app which is easy to understand. So, this is my specific question: How can I force a webview app to open links in it instead of open them in the default browser depending on domain? Please enclose an edited/expanded version of this code with your answer: public class WebViewActivity extends Activity { private WebView webView; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);

Any way to grab a logo icon from website URL, programmatically?

為{幸葍}努か 提交于 2020-01-22 15:07:20
问题 I am in the process of creating an activity where I will show the list of website visited with its logo and its alias name chosen by user. e.g. Recent Websites Visited logo1 website1/alias name logo2 website2/alias name . . so no The question is, (Ref. attached image) How to get website logo displayed on left side of http://? 回答1: It's called a favicon, and all you have to do is: If there's an icon at /favicon.ico , use that. Otherwise, get the content of the page, and extract the location

Any way to grab a logo icon from website URL, programmatically?

家住魔仙堡 提交于 2020-01-22 15:05:05
问题 I am in the process of creating an activity where I will show the list of website visited with its logo and its alias name chosen by user. e.g. Recent Websites Visited logo1 website1/alias name logo2 website2/alias name . . so no The question is, (Ref. attached image) How to get website logo displayed on left side of http://? 回答1: It's called a favicon, and all you have to do is: If there's an icon at /favicon.ico , use that. Otherwise, get the content of the page, and extract the location

清除WebView缓存

白昼怎懂夜的黑 提交于 2020-01-22 12:34:32
1. 前言 用过WebView的同学都清楚,WebView默认是会自动缓存网页资源的。虽然前端H5网页有自己一套缓存机制(不懂的同学,可以看看这篇文章 手把手教你构建 Android WebView 的缓存机制 & 资源预加载方案 ),但是在某些场景下,还是需要原生主动去做清除缓存操作,即清除WebView的缓存。大多数文章都会说,使用下列的方法就可以清除了。 new WebView(context).clearCache(true); 但实际上是这种清除方式,只是清除了一部分缓存而已。像Cookie,使用这种方式是清除不了的。 2. 解决方案 经过自己的摸索,整理出了一个有效的清除方式,具体代码如下: /** * 清除缓存 * * @param context 上下文 */ public static void clearCache(Context context) { try { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { // 清除cookie CookieManager.getInstance().removeAllCookies(null); } else { CookieSyncManager.createInstance(context); CookieManager.getInstance

javaFX webview window.onload is fired before loadworker succeeds

送分小仙女□ 提交于 2020-01-21 22:37:53
问题 I use a JavaFX webview in my application. With the following code I set a member after the page has been loaded webEngine.getLoadWorker().stateProperty().addListener(new ChangeListener<Worker.State>() { @Override public void changed(ObservableValue ov, Worker.State oldState, Worker.State newState) { if (newState == Worker.State.SUCCEEDED) { JSObject window = (JSObject) webEngine.executeScript("window"); window.setMember("mymember", new JavaScriptBridge(this)); } } }); Now in javascript I can

Android auto installation of APKs

半腔热情 提交于 2020-01-21 09:41:12
问题 I have a webview which basically is capable of intercepting all sorts of links, video, apks, hrefs. Now, what I want is once I download an APK from a url, that it'll be auto installed: This is part of the shouldOverrideUrlLoading() code: else if(url.endsWith(".apk")) { mWebView.setDownloadListener(new DownloadListener() { public void onDownloadStart(final String url, String userAgent, String contentDisposition, String mimetype, long contentLength) { } }); Intent intent = new Intent(Intent

WebView not accepting some cookies

喜夏-厌秋 提交于 2020-01-21 09:27:04
问题 I'm loading a website in Webview which uses some cookies to store session. I've written following lines to accept cookies CookieSyncManager.createInstance(this); CookieSyncManager.getInstance().startSync(); CookieManager.getInstance().setAcceptCookie(true); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { CookieManager.setAcceptFileSchemeCookies(true); CookieManager.getInstance().setAcceptThirdPartyCookies(webView, true); } webView.loadUrl("https://www.irctc.co.in/nget/train