Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>What exactly are you tring to acheive?</p> <p>If you want to know when the tab in which your webpage is loaded is closed, then <a href="https://developer.mozilla.org/en/DOM/window.onunload" rel="nofollow noreferrer">window.onunload</a> should help you.</p> <p>If you want to know when another webpage is closed, you cannot do this.</p> <p><strong>UPDATE:</strong><br> You said that you want to know when the user closes the browser or tab. This is not possible.</p> <p>But for your purpose (getting feedback), I think all you need is to differentiate whether the user is navigating to a link in your page, or whether the user is typing another URL(or by clicking a favorite).</p> <p>I think for your requirement, whether the user closes the browser, or whether he types another URL, is the same - the user is navigating away from your site, and at that time you say you want to collect feedback.</p> <p>This can be done in javascript.</p> <blockquote> <p>For all the clicks in your page that might lead to a page refresh (hyperlinks, buttons,...), set a flag.<br> In <code>window.onunload</code>, check whether this flag is set.<br> - If it is set, then the user has clicked a link in your page, do nothing.<br> - If the flag is not set then the user is navigating away, time to collect feedback.</p> </blockquote> <p>Let me know if this would work.</p> <p>PS: Note that popups/any distractions during window.unload can be very annoying. I understand that this probably is the requirements given to you. But if possible, try other mechanisms to collect (voluntary) feedback from the user.</p>
    singulars
    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.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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