NetTalk Central

Author Topic: Leave site message  (Read 3273 times)

jari@softmade.fi

  • Full Member
  • ***
  • Posts: 134
    • View Profile
    • Email
Leave site message
« on: June 04, 2021, 03:27:05 AM »
I would like to block the user from leaving the pages. For example, some sites have a question: Leave Site? Changes You Made No Be Saved. "
How to do it?

Jari

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Leave site message
« Reply #1 on: June 04, 2021, 04:33:37 AM »
well firstly, you can't really prevent them leaving the page. They could just close the tab, or browser, or just do nothing till the session times out.

But the message you're seeing is based on a before unload event. google for
javascript onbeforeunload

Cheers
Bruce