#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2005
    Posts
    52
    Rep Power
    9

    Stop Browser's Message When Change Page


    For either latest Firefox or IE, I tried to inform the user that he/she has made changes on the current form, and if the he/she wants to save the changes.

    So on the jsp, I coded:
    <script>
    window.onbeforeunload= function(){
    if (checkAnyChange() == "true"){
    displayCustomMessageModal();
    return false;
    }
    };
    </script>
    The problem is that during the process, the browser displayed its own standard warning message such as displaying:"This page is asking you to confirm that you want to leave - data you have entered may not be saved." Leave | Stay

    How can I suppress this message programmingly?

    I do not want to manually disable the message, for I can not predict how the users will set up their browsers.

    Thanks to help
  2. #2
  3. No Profile Picture
    Lost in code
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 2004
    Posts
    8,317
    Rep Power
    7170
    If you return a value from onbeforeunload, the browser will stop navigation and display its standard warning message.

    If you don't return a value from onbeforeunload, the browser will not display its standard warning message, but it also will not stop navigation.

    It is not possible to stop navigation without displaying the standard warning message.
    PHP FAQ

    Originally Posted by Spad
    Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2005
    Posts
    52
    Rep Power
    9
    Originally Posted by E-Oreo
    If you return a value from onbeforeunload, the browser will stop navigation and display its standard warning message.

    If you don't return a value from onbeforeunload, the browser will not display its standard warning message, but it also will not stop navigation.

    It is not possible to stop navigation without displaying the standard warning message.

    Thanks.

IMN logo majestic logo threadwatch logo seochat tools logo