android-webview

WebView not showing correctly

主宰稳场 提交于 2019-12-23 12:17:42
问题 WebView is not showing website correctly. Any help would be great! The code ive used work on all another site. Not sure whats the issue. Any thing I should add? Works well in chrome and other browsers so don't know what to do. Any help would be great! WebView Chrome public class Website extends Activity { WebView myWebView; LinearLayout root; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.website); myWebView =

How to access the local host server with web view in Android

 ̄綄美尐妖づ 提交于 2019-12-23 12:15:38
问题 I have an Android Application and I need to go to my web server and connect my Android Application to another program on the web. my web program is working and when I put its IP address on Android FIrefox or Browser it is working but when I call its IP address with my webview ( webView.loadUrl(my web program IP address) it's not working. Can somebody help me where is my mistake? 回答1: Make sure you are not using "localhost" from you app (a very common mistake). If you are accessing your local

Android webview doesn't execute javascript from script src

房东的猫 提交于 2019-12-23 12:14:42
问题 The Problem The webview doesn't actually execute the scripts loaded through src from a remote location Checked and double checked The permission: <uses-permission android:name="android.permission.INTERNET" /> That the file http://localhost/android/test.js exists That it called view.getSettings().setJavaScriptEnabled(true); before loading an URL The code Given a WebView view and a Context context Building a document It will need cookies so need to dynamically build it. file:// urls don't allow

Trying to open SELECT tag in Android WebView crashes the application

懵懂的女人 提交于 2019-12-23 10:24:25
问题 A similar question was asked about a year ago, and wasn't quite resolved, but I'm gonna try my luck anyhow, maybe someone knows this. I have this application that runs a couple of HTML pages in a WebView. Everything looks nice and works OK, until you try to open a SELECT tag - boom, application crashes. Here's a trace stack, if this helps: Thread [<1> main] (Suspended (exception WindowManager$BadTokenException)) AlertDialog(Dialog).show() line: 247 WebView$InvokeListBox.run() line: 7841

how to detect with javascript if browser is an android webview?

核能气质少年 提交于 2019-12-23 10:09:34
问题 I am creating a webapp and the user could only have acces with the android webview? Can i detect android webview with javascript? 回答1: var ua = navigator.userAgent.toLowerCase(); var isAndroid = ua.indexOf("android") > -1; //&& ua.indexOf("mobile"); if(isAndroid) { // Do something! // Redirect to Android-site? window.location = 'http://android.davidwalsh.name'; } Source : http://davidwalsh.name/detect-android 回答2: From http://developer.android.com/guide/webapps/webview.html#EnablingJavaScript

WebView getScrollY() always returns 0

淺唱寂寞╮ 提交于 2019-12-23 09:58:14
问题 Im trying to use the webview's scroll position to determine whether SwipeRefreshLayout should be able to refresh, except for some websites e.g. https://jobs.lever.co/memebox, getScrollY() always returns 0. Is there a way to ensure I will always get the correct scroll position? 回答1: The site you linked has a fixed header. My guess is that the page itself doesn't scroll; a container inside it does. The WebView can't inspect every scrollable container on the page, so it sees that the top-level

Android - How to access local storage values in WebView?

♀尐吖头ヾ 提交于 2019-12-23 09:32:08
问题 Is it possible to access the Local Storage data from a WebView? Here is a screenshot of Chrome of the values that I am needing to read from my app's WebView. I am needing to get the data from the "Value" column in my app. What I am trying to do, for example, is go to google.com in my WebView, then read the value "1" from the key "nullctx". Any help of how to read these values would be appreciated. 回答1: window.localStorage returns all the values in local storage. You can print them all to

How to use android:usesCleartextTraffic below Marshmallow android

吃可爱长大的小学妹 提交于 2019-12-23 07:29:08
问题 I am trying to secure webview from cleartext traffic. As mentioned in the documentation. I have to set android:usesCleartextTraffic as false to achieve this. But this works on API level 23 and above. My minimum sdk is 22. How can I make sure app doesn't crash or create any problem on device running below API level 23 ? Or how can I programmatically set that attribute value in the application tag in Manifest.xml ? 回答1: As suggested in Android Developers Blogspot, you don’t have to set

How to use android:usesCleartextTraffic below Marshmallow android

五迷三道 提交于 2019-12-23 07:29:05
问题 I am trying to secure webview from cleartext traffic. As mentioned in the documentation. I have to set android:usesCleartextTraffic as false to achieve this. But this works on API level 23 and above. My minimum sdk is 22. How can I make sure app doesn't crash or create any problem on device running below API level 23 ? Or how can I programmatically set that attribute value in the application tag in Manifest.xml ? 回答1: As suggested in Android Developers Blogspot, you don’t have to set

Android 4 long html in webview

佐手、 提交于 2019-12-23 06:07:20
问题 I have a web view in which I show HTML loaded from hardcoded string (about 1500 characters). The HTML tested in HTML validator. The html is simple contains div and p tags, not javascript. Only on Android versions 4 I got a blank page with scroll, on Android versions lower than 4 it's works fine. Unfortunately I cannot expose the hole code. Is there any difference in Android 4 WebView ? My code: mWebView.setWebChromeClient(mWebChromeClient); mWebView.setWebViewClient(mWebViewClient); mWebView