android-webview

Web View onclick event for a specific link in that webview

末鹿安然 提交于 2020-05-23 04:55:05
问题 I have a webview and I am calling data in that wv from a webservice, and in that whole description in a webview, there is a link in the last. so, my problem is that i want to open a new activity onclick of that link only neither onclick of webview nor ontouch of webview 回答1: You need to provide an implementation for shouldOverrideUrlLoading. You'll have to setup a WebViewClient for your webview and inside of this method, you'll need to have some logic that recognized that link and then open

How to open pdf from url online in Android without download option?

人盡茶涼 提交于 2020-05-17 06:33:25
问题 In my app I want the user to read the pdf files inside my app without any option to download them. How can I do this? I am using the following code but not working- WebView webView = (WebView) findViewById(R.id.webview); webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setPluginsEnabled(true); webView.loadUrl("https://docs.google.com/viewer?"+pdf_url); Is there any other way to do this? If you can do it? 回答1: You can open pdf from URL online in Android without a

Clipboard API call throws NotAllowedError without invoking onPermissionRequest()

喜欢而已 提交于 2020-05-14 17:31:23
问题 I have a simple page with a button, that when pressed, uses the Async Clipboard API to write to the clipboard. <body> <button type="button" onclick="testClipboard();"> Test Clipboard </button> </body> function testClipboard() { navigator.clipboard.writeText("Clipboard API Test").then( v => alert("Success"), e => alert("Fail\n" + e)); } This works on both Chrome and Firefox, desktop and mobile. However on Android Webview it throws the following error: NotAllowError: Write permission denied. I

Clipboard API call throws NotAllowedError without invoking onPermissionRequest()

白昼怎懂夜的黑 提交于 2020-05-14 17:31:06
问题 I have a simple page with a button, that when pressed, uses the Async Clipboard API to write to the clipboard. <body> <button type="button" onclick="testClipboard();"> Test Clipboard </button> </body> function testClipboard() { navigator.clipboard.writeText("Clipboard API Test").then( v => alert("Success"), e => alert("Fail\n" + e)); } This works on both Chrome and Firefox, desktop and mobile. However on Android Webview it throws the following error: NotAllowError: Write permission denied. I

How to persist webview cookies between app executions?

点点圈 提交于 2020-05-14 05:28:12
问题 It is possible to achieve this currently in Android? I only can find deprecated questions about old methods (CookieSynchManager) which not seems to work for this actually. It is possible to achieve it? can't find anything also on the android developers guide. Thank you 回答1: Having the same problem...I solved reading the doc here: https://developer.android.com/reference/android/webkit/CookieSyncManager For future readers: to force the Cookie sync process you can manually call the flush()

How to persist webview cookies between app executions?

夙愿已清 提交于 2020-05-14 05:27:10
问题 It is possible to achieve this currently in Android? I only can find deprecated questions about old methods (CookieSynchManager) which not seems to work for this actually. It is possible to achieve it? can't find anything also on the android developers guide. Thank you 回答1: Having the same problem...I solved reading the doc here: https://developer.android.com/reference/android/webkit/CookieSyncManager For future readers: to force the Cookie sync process you can manually call the flush()

Create a custom WebView

萝らか妹 提交于 2020-05-11 06:40:52
问题 I have a lot of WebView in different parts of the program, but these WebViews does not differ each other that is why I want to create a custom WebView with necessary settings. At the current moment, WebView doesn't show, but no errors. Am I doing something wrong? public class MyWebView extends WebView { MyWebView mMyWebView; public MyWebView(Context context) { super(context); } public MyWebView(Context context, AttributeSet attrs) { super(context, attrs); } public MyWebView initView(Context

navigator.geolocation.getCurrentPosition() never returns in WebView on Android

喜你入骨 提交于 2020-05-11 03:52:21
问题 I am trying to access the HTML Geolocation API available in Android WebView (using SDK version 24). The main problem is that the call to navigator.geolocation.getCurrentPosition() in JavaScript never returns (neither with an error, nor with position data), while on application side I check for permissions and properly pass them to WebView using android.webkit.GeolocationPermissions.Callback class. UPDATE: Just to clarify here, by "never returns" I mean that none of the too supplied callbacks

WebView Crash on Android 5-5.1 (API 21-22) Resources$NotFoundException: String resource ID #0x2040002

房东的猫 提交于 2020-05-09 19:23:09
问题 I am in the process of updating an Android app from API 27 to API 29 and I noticed that I get a crash when trying to render a WebView on an emulator based on 5.0 and/or 5.1. This issue does not happen on an emulator running 6.0 or higher (API 23-29). I cannot seem to find any documentation about WebView behaviour that would affect 5.0 or 5.1 but I can confirm the problem doesn't happen when I run the app using API 27. I am at a loss as I don't know if this is an emulator problem or an actual

DragControl not working on Android Webview (problem dragging 3d models)

扶醉桌前 提交于 2020-04-18 00:47:07
问题 ,Greetings! this question is the for the problem which I barged into after I was helped with this. This code is working fine on web browsers directly but when I try to run it Android WebView, it's not working.These are the logs which i am getting once the app starts in android studio: D/CONTENT: THREE.WebGLRenderer: Error creating WebGL context. @ 23538: https://cdn.jsdelivr.net/npm/three@0.115/build/three.js D/CONTENT: Uncaught Error: Error creating WebGL context. @ 23539: https://cdn