<img id="loading" name="loading" src="img/loading.GIF" style="position: absolute;top: 50%;left: 50%;margin-left:-32px;margin-top:-32px;">
<script>
$('#loading').hide();
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady()
{
ref = window.open('http://mywebsite.com', '_self', 'location=no,zoom=no,hardwareback=yes,hidden=yes');
ref.addEventListener('loadstart', function(event) { $('#loading').show(); });
ref.addEventListener('loadstop', function(event) { $('#loading').hide(); ref.show(); });
ref.addEventListener('loaderror', function(event) { ref.close(); alert("Connection Error!"); ionic.Platform.exitApp();});
ref.addEventListener('exit', function(event) {ionic.Platform.exitApp();});
}
</script>
In here I want to show loading.gif on the screen when inappbrowser load any page. But after first load, it doesn’t work anymore. Because loading.gif stays back of inappbrowser. How can I show this gif on the screen with every page load?