Launching survey window when user exits site
<p>I have a survey request that will be presented to a small percentage of website visitors.  I'm trying to figure out the best way to launch the survey when the user leaves the site. Initially, I was thinking of a pop-under that the user would happen upon when the closed their browser window - but I'm afraid this is probably deprecated and likely to be suppressed by the browser.  I'm wondering if someone more clever than I has an idea that might work.</p>

<p>I am using a lightbox style window to ask users if they'd be willing to a survey:</p>

<p>JQuery</p>

<pre><code>    &lt;script type="text/javascript"&gt; 
        $(document).ready(function(){
            $("a#showSurvey").click(function(){
                $("#lightbox, #lightboxPanel").fadeIn(300);
            })
            $("a#closeSurvey").click(function(){
                $("#lightbox, #lightboxPanel").fadeOut(300);
            })
        })
    &lt;/script&gt; 
</code></pre>

<p>HTML</p>

<pre><code>  &lt;div id="lightboxPanel"&gt; 
  &lt;h1&gt;We  want your opinion.&lt;/h1&gt; 
  &lt;p&gt;Would you be willing to take a short survey when you've finished viewing our site?
  &lt;p align="center"&gt; 
  &lt;a href="#"&gt;Sure&lt;/a&gt;  // launch the new window after a user is done with site??
  &lt;a id="closeSurvey" href="#"&gt;No thanks.&lt;/a&gt; //This closes the lightbox
  &lt;/p&gt; 
  &lt;/div&gt;
  &lt;div id="lightbox"&gt;&lt;/div&gt;
</code></pre>

<p>I'm not sure if there is anyway good way to do this with JS.  Perhaps this is something that should be handled with the session on the server side.</p>

<p>Any advice would be appreciated.</p>
