Conditioning window.onbeforeunload

I have this code:

window.onbeforeunload = (e) ->
  e = e or window.event
  e.preventDefault = true
  e.cancelBubble = true
  e.returnValue = "You are not done yet with your Pleading Assembly."
  # if leave this page is click then
  #  notify
  return

      

And I don't know which line of code was causing the Leave this Page button.

Leave this page button exists, even I omit it

e.preventDefault = true
e.cancelBubble = true

      

What I want to do is set a condition that if I click the "Leave this page" button, something will happen (from my side, I will notify the user)

But unfortunately I have no idea what to do.

+3


source to share





All Articles