Specific link not loading in WebView on some droids - android

I have an app out which displays this link in a web view when a user presses e-mail:
https://marauder.millersville.edu/mail/index.pl
I developed the app on an Droid X, and on my phone the link loads fine, but I have had reports from users who have an Incredible & Droid X that the link loads a blank screen.
I have tested it myself on a friends Incredible, and it indeed only loads a white screen, but I have have tested it on various other android devices and its loads fine.
And every other links also loads fine on the Incredible. I am assuming it has something to do with the SSL, being a https. I had troubles with this link on an iPhone but was able to fix it. What puzzles me is why it works fine on some devices and not on others..
Anyone have any ideas or suggestions? Thanks!
Here is how I am setting up my web view:
// setup webview
web = (WebView) findViewById(R.id.webview);
web.setWebChromeClient(new InternalWebViewClient());
web.getSettings().setJavaScriptEnabled(true);
web.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
web.getSettings().setPluginsEnabled(true);
web.getSettings().setSupportMultipleWindows(true);
web.getSettings().setSupportZoom(true);
web.getSettings().setAppCacheEnabled(true);
web.getSettings().setSaveFormData(true);
web.getSettings().setSavePassword(true);
web.getSettings().setBuiltInZoomControls(true);
web.setHorizontalScrollBarEnabled(true);
web.setVerticalScrollBarEnabled(false);

The site you are trying to load uses self signed certificates. The solution is to ignore certificate checking as described here: Does the Web View on Android support SSL?

Related

How to display website desktop version as mobile version

I have website url which loads as a full desktop version in my web view instead of mobile version. It loads fine on IOS but not on Android. Is this a problem with user agent not been detected or?
I'm trying to load this website www.mercedesbenzstadium.com
you need to edit the webview settings
mWebView.getSettings().setLoadWithOverviewMode(true);
mWebView.getSettings().setUseWideViewPort(true);
setLoadWithOverviewMode(true) loads the WebView completely zoomed out
setUseWideViewPort(true) makes the Webview have a normal viewport (such as a normal desktop browser)

Some websites dynamically update in a WebView, but others do not

I have a pretty standard WebView in which I display web pages.
For instance, when I display:
http://www.google.com/trends/hottrends/visualize?nrow=5&ncol=5&pn=p16&hl=fr
or
http://socialwall.bnpparibascardif.com/
both pages will update "dynamically", aka be animated.
But if I display:
http://pennystocks.la/internet-in-real-time/
or
http://pennystocks.la/battle-of-internet-giants/
the pages do not update "dynamically", the numbers do not change.
If I open the same two pages in the standard Android web browser (Android is version 4.4.2 on the device, also tested on another device with 4.4.4), those two last pages are animated as they should be and the numbers change.
Any clue about what that could be, or would it simply be a limitation of WebView?
Thanks!
Pages you are using are DOM based modifications , make sure your webview uses javascript.
WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
webView.loadUrl("http://pennystocks.la/internet-in-real-time/");
I have tested the above code and it works on the Android 4.2.2.

Facebook "Like Box" page disappears after brief moment in Android 4.4 KitKat WebView

An Android app uses a WebView to display a Facebook Like Box. On 4.1.2 and 4.3 the page appears correctly when the following code is used.
String url = "https://www.facebook.com/plugins/likebox.php?href=https%3A%2F%2Fwww.facebook.com%2FGoogle&width&height=395&colorscheme=light&show_faces=false&header=false&stream=true&show_border=false";
WebView webview = (WebView) findViewById(R.id.web_content);
webview.getSettings().setJavaScriptEnabled(true);
webview.setWebChromeClient(new WebChromeClient());
webview.setWebViewClient(new WebViewClient());
webview.loadUrl(url);
On 4.4.2 the page looks good in the full-on Chrome app; however, the behaviour is not good when loaded in the WebView as coded above. There is a brief flash of a fully-rendered page then the WebView goes totally white. Nothing is visible and scrolling does nothing.
I have used chrome://inspect to watch the page as it loads, but it doesn't support showing network requests. The output of running document.location.href; at the console is about:blank, though, which is a clue.
Some ideas I've tried based on various threads:
Disabling hardware acceleration
Using webview.setLayerType(View.LAYER_TYPE_SOFTWARE, null)
Using android:hardwareAccelerated="false" in AndroidManifest.xml
Disabling JavaScript
This can't work because the Like Box requires JS to display at all
Some methods on webview.getSettings()
.setSupportZoom(true), .setSupportZoom(false)
.setUseWideViewPort(true), .setUseWideViewPort(false)
.setLoadWithOverviewMode(true), .setLoadWithOverviewMode(false)
Running custom CSS after the page is loaded to set a white background
I make sure it runs by creating an alert() directly afterward
At this point I may have to resort to starting an intent when running in 4.4 so the page is loaded by the browser in that case, but I would prefer to find a fix for the blank WebView. Are there any other settings I can tweak?
The above doesn't repro for me on 4.4
I have used chrome://inspect to watch the page as it loads, but it doesn't support showing network requests.
It totally does support showing network requests. Try this - in your app comment out loading the URL, just new the WebView up. Connect via DevTools and type
window.location = 'https://....';
The output of running document.location.href; at the console is about:blank, though, which is a clue.
Sounds like this is it. I'm not sure what the HTML/JS you end up loading does, maybe the JS tries to navigate to some weird URL? Try setting a WebViewClient that logs all shouldOverrideUrlLoading calls and see if you're getting a non-http(s) URL there. Try returning true for that URL.

WebView cannot display websites design

I have one responsive website. I load it in my android application using Webview. In some devise like samsung s2, micromax tablet it load with proper manner with website design. but In some devise like sonyxperia and emulltor I load only text of website not loaded website design. my website is responsive. I used below code to load website
webView=(WebView)findViewById(R.id.webView);
webView.getSettings().setJavaScriptEnabled(true);
webView.loadUrl("http://xyz responsive url");
If any one have solution to load mobile app on android devise then please comment here.
Depending on the Android version you're using, WebView will not be able to render you website as you expect because it is not a full browser, but it has only some HTML rendering capabilities.
Starting on Android 4.4 (KitKat), WebView uses the same rendering engine as Chrome, so the render of your website using WebView should be much more consistent.
Also, WebView in Android < 4.4 won't have support for all JavaScript you may want to run in your webpage.
If you're trying to render an HTML5 webpage, try your WebView component using HTML5test and see if it has support for all the features you want in your webpage.

Android WebView VS Phone Browser

I've experienced a LOT of strange behaviours with using WebView in Android and I'm wondering why there are so many diffrences between the WebView and the Browserinstalled on each phone?
As an example, I've developed some applications that had to display HTML content, which contained either jquery-mobile, flash,javascript, YouTube embedded and so on. So I had a lot of problems with displaying this pages inside WebViews. Either they wouldn't get displayed at all, just blank, either the videos won't play and so on. And the strange thing is that they work properly if opened in the Browser installed on the phone. I had JavaScript enabled, I tried diffrent WebSettings, I had set the WebChromeClient and WebViewClient looking for javascript errors... but nothing worked.
So I got to the conclusion that the WebView component is completely different from the Browser application installed on the phones. I'm thinking that every manufacturer makes their own Browser to support as many as possible pages, and the WebView remains the standard one, included in the Android SDK.
Am I right? Or there is another reasons/explanation for this?
Thanks.
EDIT: Everything that #ondoteam has suggested was enabled and set at the time being. I no longer have the references to that websites, which anyway were internal.
This article outlines your speculation about stock browser differences between manufacturers, that absolutely is true: 5 reality checks every team needs before working on Android webkit
...which does cause trouble and mysterious/difficult to diagnose/solve problems.
As far as your issues with your WebView implementation:
Version of jquery-mobile may be an issue jquery-mobile loaded into an android WebView if you are using jquery.mobile-1.0.1.min.js you may want to try the uncompressed jquery.mobile-1.0.1.js
And Flash :-/ Good luck:
Screen blinking when using a webview with flash
Flash in WebView not working on Android 3.2
Flash video not displaying in WebView for Android 3.0.1
For loading SWF:
Load an SWF into a WebView
loading flash files (.swf) webview in android
Good luck with that, seems like a lot of variables with devices, Android versions, etc. And will take persistence with trial/error.
The stock browser and WebView differs .Using all the tweaks like
WebView browser;
browser.clearFormData();
browser.clearHistory();
browser.clearCache(true);
browser.getSettings().setAppCacheEnabled(true);
browser.getSettings().setDatabaseEnabled(true);
browser.getSettings().setDomStorageEnabled(true);
browser.setWebChromeClient(new WebChromeClient());
still it does not load high resolution images properly which is being loaded perfectly well by the android browser.
Only part of the image can be visible on the webview screen which appears fully on normal android browser.
This behavior is observed with latest Android 4X SDK as well.
Which means android default browser significantly tweaks the webkit/webview code to show any url
WebView by default is restricted. You should call setWebChromeClient and family to have a decent browsing experience. In addition, don't forget setJavaScriptEnabled() and other similar stuff. Sorry for my brevity... I think that you don't need examples.
http://developer.android.com/reference/android/webkit/WebView.html
have you checked this question : jquery-mobile loaded into an android WebView
it might be that you're using the wrong libraries. Just check in any case.

Categories

Resources