Unable to prompt user with leave or stay message

Discuss how to use and promote Web standards with the Mozilla Gecko engine.
Post Reply
tjosephp
Posts: 2
Joined: July 25th, 2017, 1:08 pm

Unable to prompt user with leave or stay message

Post by tjosephp »

We have an issue where we are trying to bind the beforeunload to the window to prompt the user with a "Leave or Stay" message. If the user doesn't click or press a key, they are able to close the browser without a prompt. However, if they do click or press a key, they do get the message.

Is there a way to make the prompt appear even if the user has not yet taken action on the window? Or is this a security block that is browser specific?
User avatar
DanRaisch
Moderator
Posts: 127166
Joined: September 23rd, 2004, 8:57 pm
Location: Somewhere on the right coast

Re: Unable to prompt user with leave or stay message

Post by DanRaisch »

No bug here. Moving to Web Development.
tjosephp
Posts: 2
Joined: July 25th, 2017, 1:08 pm

Re: Unable to prompt user with leave or stay message

Post by tjosephp »

I considered this a bug because in every other major browser (IE, Safari, Chrome) this behavior is the same - bindings happen instantly, but Firefox does not.
User avatar
Frenzie
Posts: 2135
Joined: May 5th, 2004, 10:40 am
Location: Belgium
Contact:

Re: Unable to prompt user with leave or stay message

Post by Frenzie »

You didn't post any code so there's no way to tell one way or the other.

https://developer.mozilla.org/en-US/doc ... nloadEvent
Intelligent alien life does exist, otherwise they would have contacted us.
Post Reply