WebView start url Android 4.4.3


We have a nexus 5 with the latest version of Android (4.4.3) and a hybrid web app running inside a webview. Before this update we checked for the url inside the method onPageFinished to begin with “/” or “about:blank” to render the login page of our web app. Something like:

if (url.equals("/") || url.equals("about:blank"))

And this is not working anymore for devices with 4.4.3

Which condition should I add to support this devices?


Ok, I found the solution. Before the code of the question, we were launching the webview with an image to show a loading message before the load of the app. Using:

  webview.loadDataWithBaseURL("/", wait_html, "text/html", "UTF-8", "");

The wait_html parameter is an image tag inside a body tag. That html is what I’m getting in the method onPageFinished the first time the web view is launched as the url. This behaviour is not the same as it was in previous versions of Android. We changed the way it was implemented to use just a boolean variable to check if it is the first time the web view is created to load the url of the server.

if (FirstTime) 
 FirstTime  false;

Answered By – rodeleon

Leave a Comment