Confirmation notification fails to appear on Firefox browser

I have implemented a script I found online that generates a confirmation message when a user tries to leave a page without submitting a form after making changes.

Here is the script I am using:

<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 = 'Don't forget to fill out the task journal! ';
        
        if (formSubmitting || !_isDirty) {
            return undefined;
        }
        else{
            (e || window.event).returnValue = confirmationMessage; 
            return confirmationMessage;  
        }

    });
};
</script>

When I use this script in Google Chrome, I see this: https://i.sstatic.net/Ll6a9.png

And when I use it in Mozilla Firefox, I see this: https://i.sstatic.net/o8Ump.png

Does anyone know how I can customize the confirmation message in Firefox? Ideally, replacing the existing text with my own would be perfect.

Answer №1

According to information provided in the official documentation:

In newer versions of Firefox starting from version 4, the custom message returned is no longer shown directly to the user. Instead, Firefox will display a standard notification saying "This page is asking you to confirm that you want to leave - data you have entered may not be saved." More details can be found in bug report 588292.

Note that it is not possible to change or customize this default message.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Activate DivMenu's second list item automatically

I've been trying to use the trigger function multiple times, but it just won't work. I need help with auto-triggering the menu of the second list element. Can someone please assist me? Here is a snippet of my code: $("document").ready(functio ...

Finding elements in Vue.js and Nuxt.js without using querySelectorAll

Currently, my code includes: var images = Array.from(this.$refs["dynaContent"].querySelectorAll("img")); While this code functions properly on the webpage, there is an error log displayed in the terminal: ERROR [Vue warn]: Error in ne ...

Jquery onchange event fails to fire

$('#selectclassid').trigger("change"); $('#selectclassid').on('change', function() { }); When trying to manually trigger the onchange event, it does not seem to be firing as expected. Although this format is commonly seen ...

Output a variable that is generated from invoking an asynchronous function

I'm currently in the process of developing an application that is going to leverage the capabilities of a SOAP server through the use of the https://github.com/vpulim/node-soap module. One of the main challenges I am facing is how to efficiently crea ...

Tips for testing and verifying the call to a specific Firebase method within a function using Jest

Within the file App.ts, I am utilizing the method firebase.auth().signInWithEmailAndPassword(email, password). Now, my objective is to conduct a unit test to ensure that when the myAuthenticationPlugin.authenticate(email, password) method is invoked from ...

Destroy Three.js Renderer

Is there an effective method to properly destroy a three js instance? I am encountering an issue where removing the canvas and re-adding it results in two renderers being created. Presently, my approach involves: Removing all event listeners Cancellin ...

Position the colored div on the left side of the page

Here is the CSS I am currently using... <style type="text/css"> .widediv{width:1366px;margin-left:auto;margin-right:auto} </style> This CSS code helps me create my webpage : <body><div class="widedivv"> <!-- Content go ...

Launch a new Windows form upon clicking an HTML button using DotNetBrowser

I attempted to open a Windows form using the DotNetBrowser control with specific HTML content as shown in the code below. Upon clicking a button on the HTML page, I want to hide the loaded form and then display the second Windows form. Here is the C# cod ...

Creating an object key using a passed literal argument in TypeScript

Can the following scenario be achieved? Given an argument, how can we identify the object key and access it? Any potential solutions? async function checkKey(arg:'key1'|'key2'){ // fetchResult returns an object with either {key1:&apo ...

Guide on converting data from PHP to JSON using JavaScript

Here is some data that I need to loop through: image1 url1 description1 image2 url2 description2 image3 url3 description3 image4 url4 description4 image5 url5 description5 After looping through the data: var imagesDataArray = [ { src: &apo ...

What is the most effective way to output data using the response.write method in a Node.js program after retrieving it from a MySQL server?

Currently working on a NodeJS web app and encountering a roadblock. Seeking feedback on my code: var config = require('./config.json'); var mysql = require('mysql'); var http = require('http'); var url = require('url&apo ...

By utilizing jQuery, I am orchestrating the movement of a series of div elements within a container with the simple click of a button

A group of div elements located within a container. When the button is clicked, the train should start moving. <script> $('document').ready(function(){ $("button").click(function(){ $("#train").animate({left: "300px"}, 2000); ...

Creating a Standard DIV Element (JavaScript Code)

Just a quick question here. http://jsfiddle.net/fkling/TpF24/ In this given example, I am looking to have < div>Bar 1</div> open as default... Any suggestions on achieving that? That would be all for now. Thank you so much! :D The JS script ...

Learn how to use Javascript and ASP.NET to refresh the parent page in Mozilla Firefox browser

The code window.opener.location.reload(); works well in Internet Explorer, but it doesn't refresh the parent page in Mozilla Firefox. Can someone please advise me on how to refresh the parent page in a way that is cross-browser compatible? Here is th ...

I keep encountering an error in the console log, any tips on resolving it?

Whenever I use replit, the console log keeps indicating that a script is missing every time I attempt to run it. Despite having run = "npm start" in the replit file, running it prompts an error saying that the script "start" is not found. You c ...

Submitting a POST request to paginate and sort the results

Currently, I have a system in place where a GET request is used to query the database and display the results. While this method works well, I am looking to transition it into a POST request. This would allow for a more flexible approach by handling JSON b ...

The file "tfjs_binding.node" could not be located in the directory where @tensorflow is installed

After attempting to utilize certain functionalities of TensorFlow, I encountered an error indicating that "tfjs_binding.node" was not found in the @tensorflow installation folder. I made sure to install Python 2.7 as a prerequisite for TensorFlow and veri ...

Fetching data using JSONRequest sample code

I am new to web development and this is my first attempt at using JSON. On the JSON website (http://www.json.org/JSONRequest.html), they recommend using JSONRequest.get for certain tasks. However, I keep running into an error stating "JSONRequest is not ...

Including item from ajax not within $.when function finished

function fetchData(){ return $.ajax({ url : 'URL1', data : { id : id }, type : 'GET', }); } function fetchItemData(item_id) { return $.ajax({ url: 'URL2', data: { item_id: it ...

Scale transformation - I am aiming for it to exceed the limits, yet it remains contained within

Currently, I am working on enhancing my carousel by implementing a zoom effect when hovering over the images. However, I have encountered an issue where the image gets hidden within the div container and doesn't overflow as expected. I tried adjusting ...