Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to exactly execute onload script & exit pop up?
    primarykey
    data
    text
    <blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/2753827/display-message-when-user-leaves-site">Display message when user leaves site</a> </p> </blockquote> <p>Ok, this is my situation - I'd like my user to start a download automatically when they land on my page, which I had this code:</p> <pre><code>&lt;body onload="document.getElementById('download').click()"&gt; &lt;a id="download" href="http://www.website.com/file.zip" style="display:none;"&gt;Download&lt;/a&gt; </code></pre> <p>This works.</p> <p>However the problem is that, I have another script at the bottom that executes a popup message when the user tries to leave the page as follows:</p> <pre><code>&lt;script language="javascript"&gt; var exitsplashalertmessage = '***************************************\n\n &gt; &gt; &gt; W A I T &lt; &lt; &lt;\n\n CLICK THE ***CANCEL*** BUTTON\n on the NEXT Window for Something\n VERY Special!\n\n***************************************'; var exitsplashmessage = '***************************************\n\n W A I T B E F O R E Y O U G O !\n\n CLICK THE *CANCEL* BUTTON RIGHT NOW\n TO STAY ON THE CURRENT PAGE.\n\n I HAVE SOMETHING VERY SPECIAL FOR YOU!\n\n***************************************'; var exitsplashpage = 'http://www.website.com/more'; &lt;/script&gt; &lt;script language="javascript" src="http://www.website.com/exitsplash.php"&gt;&lt;/script&gt; </code></pre> <p>And the problem now is that, the download file works fine, but the exitsplash doesn't execute.</p> <p>I have been told that I need to "onUnload" the code in the ... but how can I do this?</p> <p>Anyone, any ideas?</p> <p>Thank you</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload