Hi all!

I'm having some troubles trying to know the end of a page load in a very particular case. Here it is :

1) page is loaded
2) it has a button : "Print PDF"
3) when click on it, the following code is executed:
window.location.href = "printpdf.php";
4) the php page returns the pdf, asking for download (or open with), so headers are set to "Content-type: application/pdf"

Is it possible to know when the popup "download / open with" appears? I tried to put a "window.onload=function(){alert('hi');}" just before the location.href, but nothing happens.

What I would like to do is to display a "please wait" after clicking the button, and remove it when the pdf is generated. Is there a solution or may I search a totally other way to do it? (The full reload of the page is not an option, unfortunately)