Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8163515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T19:04:43+00:00 2026-06-06T19:04:43+00:00

I have my JavaScript alert on a page which alerts user with my custom

  • 0

I have my JavaScript alert on a page which alerts user with my custom message.

About my script, when a user try to exit or refresh a page they get alert with my custom message
"Please Stay on this page to avail discount"
When they choose to stay they are redirected to
discount_offer.html

MY SCRIPT:

<script language="javascript">
    var vals=0;
    function displayMsg() {
        window.onbeforeunload = function evens(evt) {}
            window.location.href = 'discount_offer.html';
    }
    window.onbeforeunload = function evens(evt) {
    var message = 'Please Stay on this page to avail discount';
      if (typeof evt == 'undefined') {
          evt = window.event;
      }
        timedCount();
        vals++;
      if (evt) {
          evt.returnValue = message ;
          return message ;
      }
      trace(evt);
    }
    function timedCount()
    {
        t=setTimeout("timedCount()",100);
        if(vals>0)
        {
            displayMsg();
            clearTimeout(t);
        }
    }
    </script>
    
<p> <h1> My page Content here! </h1> </p>

>> PROBLEM:

My script works perfectly in Chrome, but it does not show my Custom Message in Firefox. Instead, it shows a Firefox default message:

"This page is asking you to confirm that you want to leave – data you have entered may not be saved"

>> My Question Is:

How can I get rid of this default Firefox message and show my message?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T19:04:44+00:00Added an answer on June 6, 2026 at 7:04 pm

    No, there’s no way you can change it:

    In FF 4 and later the returned string is not displayed to the user, as per this bug.

    An alternative solution would be to highlight unsaved fields and/or put a message somewhere on the page.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Good morning! I have a user login page /Account/Login.aspx which uses a custom I've
I have a javascript function which redirects user to a diff page. It goes
I have the following Javascript code add_num = { f: function(html, num) { alert(this.page);
I have the following problem: <script type=text/javascript> alert(1. ČĆŽŠĐčćžšđ); </script> <script type=text/javascript src=Tst.js></script> <script
I have this simple function: <script type=text/javascript> //<![CDATA[ jQuery(function($){ function here(b){alert(b);} ; here(6); });
I have an alert box in JavaScript which is prompted by clicking a link
I have a aspx page (default.aspx), inside which I am loading a user control
We have a browser test page which is used to diagnose user problems. There
I have a page which may has about more than 1 form like below.
I have an aspx page which holds 2 user controls UC1: Edit page -

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.