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

  • Home
  • SEARCH
  • 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 8481495
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T19:34:17+00:00 2026-06-10T19:34:17+00:00

I am trying warn user to save data if he wants leave the page.

  • 0

I am trying warn user to save data if he wants leave the page. The message should display simple “Do want save the data?” , If YES call code behind method (asp:button click), if NO leave the page from the page.

But now It is showing Unwanted message string with my message (see below).

enter image description here

 var form_has_been_modified = 0;
    $(function () {

        $("input").keyup(function () {
            form_has_been_modified = 1;
        })
        window.onbeforeunload = function (e) {
            if (!form_has_been_modified) {
                return;
            }

            var message = "Do you want to save the data before leave the page?";

            return 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-10T19:34:19+00:00Added an answer on June 10, 2026 at 7:34 pm

    Unfortunately this is the browser behavior and you cannot change it.
    You may want to re-word your message so that it makes sense in the context of the browser’s pre-defined message. Also, make sure you test other browsers, as the message and behavior may be different.

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

Sidebar

Related Questions

I'm using Drupal 7 and the Commerce module. I'm trying to warn the user
There are certain configuration files that the user should save before closing the browser.
I want to prompt the user to enter a database name and warn him
Im trying to add a UIAlertView to warn the user that the link will
Trying to implement LoaderManager + CursorLoader. In onFinish method adapter should swap its cursor
Basically I am trying to put a button in my app which will warn
I want my error page of my seam application to redirect to the home
I'm trying to do an application that warns me when a user finishes uploading
I am trying to use smart Gwt, Listgrid. I am using both com.google.gwt.user.client.ui and
I'm trying to detect changes to input fields to warn users of unsaved changes

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.