When user clicks download button/link the loading screen appears on the page. I use onblur event on this button to hide my loading screen after download process is finished. It works fine in any browser, but not Google Chrome.
Is there any event listener or other simple way which I can use for Chrome?
Link:
<a href="/resources/foo" class="show-ls" onblur="hideLS()">Download</a>
show-ls function just shows loading screen:
$('.show-ls').click(function () {
$('#loading-screen').show();
});
loading screen is div element in body:
<div id="loading-screen" class="loading-screen" style=""></div>
.loading-screen {
background: rgba(255, 255, 255, 0.6) url('/images/loadingscreen.gif') no-repeat fixed center center;
width: 100%;
height: 100%;
position: fixed;
}
hideLS function just hides the loading screen:
hideLS= function () {
var loadingScreen = $('div.loading-screen');
if (loadingScreen.length > 0)
loadingScreen.hide();
};
Downloading process is ok, loading screen is fine too. The problem is only with hiding loading screen after downloading file is finished in Chrome.