WebView not reflecting changes to web page contents - android

I have a web application running on an AWS and an Android app which is just a WebView to just reflect the web application.
I had the setAppCacheEnabled set to True earlier, but I commented that piece of code in the recent version of the application.
Anytime an update is made to the web page contents, the change does not reflect on the Android WebView.
Below is a snippet of the code:
setContentView(R.layout.activity_main);
myWebView = (WebView)findViewById(R.id.webView);
WebSettings webSettings = myWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
//improve webView performance
myWebView.getSettings().setRenderPriority(WebSettings.RenderPriority.HIGH);
myWebView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
//myWebView.getSettings().setAppCacheEnabled(true);
myWebView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
webSettings.setDomStorageEnabled(true);
webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS);
webSettings.setUseWideViewPort(true);
webSettings.setSaveFormData(true);
webSettings.setSavePassword(true);
webSettings.setEnableSmoothTransition(true);
myWebView.loadUrl(<my web application URL>);
myWebView.setWebViewClient(new WebViewClient());

Related

on android webview avoid or block unexpected open help center for cookies

i have development a android app with web view but sometimes it opens the help center for cookies:
this is my configuration:
webSettings = webview.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
webSettings.setDomStorageEnabled(true);
webSettings.setAllowFileAccess(true);
webSettings.setAllowContentAccess(true);
webSettings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
webSettings.setGeolocationEnabled(true);
webSettings.setSaveFormData(true);
how can i prevent this from happening?
Add this line after initialize your webview
CookieManager.getInstance().setAcceptCookie(true);

Webview Android - Not showing Menu of the website

Not showing menu in android app
In chrome and other browser it shows properly as below
Chrome showing proper menu
everything is enabled Dom, Javascript - code snippet as below.
webSettings.setJavaScriptEnabled(true);
webSettings.setDomStorageEnabled(true);
webView.getSettings().setLoadsImagesAutomatically(true);
webView.setScrollBarStyle(View.SCROLLBARS_OUTSIDE_OVERLAY);
webView.setWebViewClient(new WebViewClient());
webView.setWebViewClient(new Browser_Home());
webView.setWebChromeClient(new ChromeClient());
webSettings.setAllowFileAccess(true);
webSettings.setAppCacheEnabled(true);

i Cant Select file in my own browser in android

I have created an android app for a simple website view (Using webview) but I can't select file using
I am trying to make a app which completely load the website made using php
use your Web view in this way .
webview =(WebView) findViewById(R.id.webView);
WebSettings webSettings=webview.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setDomStorageEnabled(true);
webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
webSettings.setDatabaseEnabled(true);
webview.setWebViewClient(new WebViewClient());
webview.loadUrl(url);

webpages not loading properly in android webview

I want to load a website in android webview which has pretty good design but in webview only html content is showing. I don't have experience with Web but I think the CSS is not loading.
webView = (WebView) findViewById(R.id.webView);
webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setLoadWithOverviewMode(true);
webSettings.setDomStorageEnabled(true);
webSettings.setUseWideViewPort(true);
webSettings.setLoadWithOverviewMode(true);
webView.loadUrl(myURL);
webView.setWebChromeClient(new ChromeClient());
webView.setWebViewClient(new MyWebViewClient());
Its working fine in iOS webview and in browsers.
Please help. Thanks!

Jquery datepicker not showing in Android Webview. Works in native browser

I'm trying to embed an HTML page in a webview. The page has some jquery and javascript. When an input field is clicked it brings out the jquery datepicker. It works well in the native browser but, doesn't work in the webview. I did set enableJavascript to true but still not showing. So I'm not sure how it works if opened in the native browser, but not if is in webview. Am I missing anything? Any help is appreciated. This is my code:
myWebView = (WebView) findViewById(R.id.webView);
//Enable Javascript
WebSettings webSettings = myWebView.getSettings();
webSettings.setLoadWithOverviewMode(true);
//Enable DOM Storage
webSettings.setDomStorageEnabled(true);
//Enable Zoom
webSettings.setBuiltInZoomControls(true);
//I was adviced to place some of this to handle page navigation:
myWebView.setWebChromeClient(new WebChromeClient());
myWebView.setWebViewClient(new WebViewClient());
//other settings
myWebView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
myWebView.setScrollbarFadingEnabled(false);
//finally, load url
myWebView.loadUrl("https://www.mycustomurl.com");
You have to enable Javascript in your webview...
like this,
WebView.getSettings().setJavaScriptEnabled(true);
in your code, add this too..
webSettings.setJavaScriptEnabled(true);

Categories

Resources