This site will have limited functionality while we undergo maintenance to improve your experience. If an article doesn't solve your issue and you want to ask a question, we have our support community waiting to help you at @FirefoxSupport on Twitter and/r/firefox on Reddit.

ابحث في الدعم

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

Pop-up message: "this page is asking you to confirm that you want to leave - data you have entered may not be saved"

more options

It happens often: I am typing into a text input form on a website, and the pop-up (see attachment) appears for no apparent reason. In other words, I did not deliberately try to abandon my text entries, but for some reason the browser believes I have. Perhaps this is down to the overuse of shortcuts and touchpad "gestures" in my Macbook? I don't know why it happens, but it does. My question only concerns what happens AFTER the pop-up appears.

The pop-up has two buttons: "Stay on page", and the DEFAULT "Leave Page".

I have lost hours of work (text entry) because the DEFAULT is to "Leave Page". Again, this may be "physically" due to the twitchy Apple products I use, but it could be avoided if the DEFAULT were set to "Stay on page".

That is my first question: How do I change the DEFAULT to "Stay on page"?

I am told that this pop-up is the product of JavaScript running in my browser. That's all well and good, but it's not clear to me whose script this is.

My second question: What is the SOURCE of the JavaScript producing the pop-up; i.e. is this sourced by Mozilla, or is it sourced by the website creators?

It happens often: I am typing into a text input form on a website, and the pop-up (see attachment) appears for no apparent reason. In other words, I did not deliberately try to abandon my text entries, but for some reason the browser believes I have. Perhaps this is down to the overuse of shortcuts and touchpad "gestures" in my Macbook? I don't know why it happens, but it does. '''My question only concerns what happens AFTER the pop-up appears. ''' The pop-up has two buttons: "Stay on page", and the DEFAULT "Leave Page". I have lost hours of work (text entry) because the DEFAULT is to "Leave Page". Again, this may be "physically" due to the twitchy Apple products I use, but it could be avoided if the DEFAULT were set to "Stay on page". That is my first question: '''How do I change the DEFAULT to "Stay on page"? ''' I am told that this pop-up is the product of JavaScript running in my browser. That's all well and good, but it's not clear to me whose script this is. My second question: '''What is the SOURCE of the JavaScript producing the pop-up'''; i.e. is this sourced by Mozilla, or is it sourced by the website creators?
Attached screenshots

الحل المُختار

Yes, anything you type that isn't an exact match to an existing preference will generate that bar with the plus button to create a new preference.

Read this answer in context 👍 1

All Replies (6)

more options

Websites can set up an event listener on the "beforeunload" event. Firefox displays that standard dialog in that case. Firefox won't display the dialog on its own.

I'm not aware of a way to change the default button in the dialog.

Source of the Issue

Do you think it's possible that a gesture does the same thing as the Back button? That would be considered navigating away from the page.

The Backspace key, when pressed outside of a form field, can trigger Back. To rule that out, here's how you can disable that feature:

(1) In a new tab, type or paste about:config in the address bar and press Enter/Return. Click the button accepting the risk.

(2) In the search box in the page, type or paste backsp and pause while the list is filtered

(3) Double-click the browser.backspace_action preference to display an editing field, and change the value to 2 then press Return or click the blue check mark button to save the change.

More info on about:config: Configuration Editor for Firefox.

Potential Workarounds

There are some add-ons for saving form data as you work to protect against data loss. I haven't tried these myself:

more options

Two fields presented in response to `backsp`: the one you described, and one other - a Boolean simply labeled backsp. (See attachment) I wasn't sure what to do about the Boolean - or if they were related. Apparently I changed it, and now it says True. Is that correct, or should it be False?

more options

Oh, you didn't need to create a new preference called backsp. You can use the trash can icon at the right end of the bar to delete it. Anyway, Firefox is ignoring it since it doesn't match up with any known extension.

more options

Odd... AFAIK, I did nothing to create it. I followed your instructions, and there it was. When I first saw it, the "radio button" for Boolean was selected - I thought it was advising the data type of the browser.backspace_action preference!

That's good to know... I guess it does this (offer to create a new preference) each time you search for a term?

more options

And just one other thing before leaving this:

What was the logic behind setting the default action as "Leave Page"? I just don't get that.

Oh - a second thing: Thanks so much for your time, and your help. I feel enlightened  :)

more options

الحل المُختار

Yes, anything you type that isn't an exact match to an existing preference will generate that bar with the plus button to create a new preference.