0 Replies - 206 Views - Last Post: 22 September 2011 - 01:26 AM

#1 X-spert  Icon User is offline

  • D.I.C Head

Reputation: 7
  • View blog
  • Posts: 56
  • Joined: 25-August 11

Problem with a javascript-jQuery function

Posted 22 September 2011 - 01:26 AM

Hi,

I have this function:
function busyWaiting() {
	emd = document.getElementById("mainDiv");	
    if (emd != null) {
           emd.innerHTML += "<div id='loader'><div class='backgroundEffect'></div>
                             <div class='element'><img src='i/loading.gif' /><br />"
        	              + sistem +" Loading...</div></div>";           
    }
}



I call this function from an layout with this script:
<script>	
	var sistem='<bean:message bundle="private" key="application.title.short"/>';
	window.onbeforeunload = busyWaiting;
</script>



All works fine, when I call it onbeforeunload it will appear like a loading effect to the next page.
My problem is when I click to download a file generated from a form submit... onbeforeunload the loading effect will execute and in the same time with a small delay will appear the browser dialog "open/save/cancel" box... and because the page don't make the unload the loading effect remain in window until I make a refresh.
I don't find a way to control the dialog "open/save/cancel" box with jQuery or Javascript and after I hit one action from the box, loading effect to disappear.
Thank you in advance!

This post has been edited by X-spert: 22 September 2011 - 01:28 AM


Is This A Good Question/Topic? 0
  • +

Page 1 of 1