Titas Kurtinaitis
Titas Kurtinaitis

Reputation: 309

Confirmation message doesn't show up in firefox web browser

I am using script which I found in the internet to generate my confirmation message whenever user try to leave page without submitting form after changes.

There is my script:

<script type="text/javascript">
  var formSubmitting = false;
  var setFormSubmitting = function() { formSubmitting = true; };

    var _isDirty = false;
    var setDirtyField = function() { _isDirty = true; }
    window.onload = function() {
    window.addEventListener("beforeunload", function (e) {
        var confirmationMessage = 'Nepamirškite užpildyti užduoties žurnalo! ';
        //confirmationMessage += 'If you leave before saving, your changes will be lost.';

        if (formSubmitting || !_isDirty) {
            return undefined;
        }
        else{
            (e || window.event).returnValue = confirmationMessage; //Gecko + IE
            return confirmationMessage; //Gecko + Webkit, Safari, Chrome etc.  
        }

    });
};
</script>

That's what I see in google chrome with this script:

And that's what I see with the same code in firefox web browser: enter image description here

Any idea how to add mine text to firefox confirmation message? Replacing exist text with mine would be perfect.

Upvotes: 0

Views: 945

Answers (1)

Quentin
Quentin

Reputation: 943645

This is documented behaviour:

In Firefox 4 and later the returned string is not displayed to the user. Instead, Firefox displays the string "This page is asking you to confirm that you want to leave - data you have entered may not be saved." See bug 588292.

You can't override the default text.

Upvotes: 2

Related Questions