0

I'm trying to launch a "logout" page if the usesr closes the browser...I've looked for a couple of days and I think I have looked at all of the related topics...tried quite a few...but so far, nothing is working the way I need it to...

Everything seems to trigger just navigating to the next page...I want to be able to navigate the site and NOTHING IF I LOG OUT...but if I CLOSE THE BROWSER (or the DOMAIN changes), I want to fire the logout page.

Actually, it really doesn't need to open a popup...but that would be my preference...

Thanks for any help in getting a definitive answer...

HOLD THE PHONE...

Just FYI...I found what seems to be working here: [http://eureka.ykyuen.info/2011/02/22/jquery-javascript-capture-the-browser-or-tab-closed-event/][1]

...and it also seems that there are some very useful variations from contributers.

I also added a line to the original script to execute my logout page...

Edward
  • 1
  • 3

1 Answers1

0

You should be able to add a listener using onbeforeunload and ask the user if they want to log out in the prompt https://developer.mozilla.org/en-US/docs/DOM/window.onbeforeunload

David Storey
  • 29,166
  • 6
  • 50
  • 60