I am creating a android app in phonegap cordova ,here i am converting website into webview using in appbrowser pluggin.my problem is while loding inappbrowser it shows white screen in app ,is there any way to avoid this blank screen.i have set the flash sreen for app,but it is not efects to inappbrowser.
I can get the solution to the problem in following one of way
1)if there is any way to set flash screen to inappbrowser
or
2)if i am able to load inappbrowser asynchronously ,during loading time i can show flashscreen of app
or
3)any other sollution?
i have used the following javascript code
function onDeviceReady() {
var url = 'http://www.mahadevaastro.com/bayarkart/';
var target = '_blank';
var options = "location=no,zoom=no"
var option1 = "zoom=no"
var ref = cordova.InAppBrowser.open(url, target, options);
// var ref = window.open(url, target, options, option1);
ref.addEventListener('loadstart', loadstartCallback);
ref.addEventListener('loadstop', loadstopCallback);
ref.addEventListener('loadloaderror', loaderrorCallback);
ref.addEventListener('exit', exitCallback);
function loadstartCallback(event) {
showSpinner();
}
function loadstopCallback(event) {
hideSpinner();
}
function loaderrorCallback(error) {
console.log('Loading error: ' + error.message)
}
function exitCallback() {
console.log('Browser is closed...')
}
function showSpinner() {
navigator.notification.activityStart("Bayar Speed Kart", "Its loading....");
// $.mobile.loading("show");
}
function hideSpinner() {
navigator.notification.activityStop();
//$.mobile.loading("hide");
}
// Handle the Cordova pause and resume events
document.addEventListener( 'pause', onPause.bind( this ), false );
document.addEventListener( 'resume', onResume.bind( this ), false );
// TODO: Cordova has been loaded. Perform any initialization that requires Cordova here.
};
Once i too suffered from same proble how i solve the problem is by loading an gif image in loadstart method
ref.addEventListener("loadstart", function () {
ref.executeScript(
// { code: "document.body.style.backgroundColor = 'yellow';" },
{ code: "document.body.style.background = 'url(loading.png)';" },
// url("paper.gif");
function (values) {
//alert(values[0]);
}
);
});