為了改善您的使用體驗,本網站正在進行維護,部分功能暫時無法使用。若本站的文件無法解決您的問題,想要向社群發問的話,請到 Twitter 上的 @FirefoxSupport 或 Reddit 上的 /r/firefox 發問,我們的社群成員將很快會回覆您的疑問。

搜尋 Mozilla 技術支援網站

防止技術支援詐騙。我們絕對不會要求您撥打電話或發送簡訊,或是提供個人資訊。請用「回報濫用」功能回報可疑的行為。

了解更多

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?
附加的畫面擷圖

被選擇的解決方法

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.

從原來的回覆中察看解決方案 👍 1

所有回覆 (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.