www.webdeveloper.com
Results 1 to 3 of 3

Thread: onbeforeunload: close window vs. back button

  1. #1
    Join Date
    Feb 2010
    Posts
    7

    onbeforeunload: close window vs. back button

    Hi,
    I have the following problem:
    When I use this script it pops up both if a user tries to close the window and also if he presses the back button. Please tell how to show another window or do another action when the back button is pressed? I know it is possible although a lot of people say it's not.
    Code:
    <script type="text/javascript" type="text/javascript">
    window.onbeforeunload = confirmExit;
      function confirmExit()
      {
        return "Go to www.quickiqtest.net/resultsqen.php if your browser had problems with showing the results.";
      }
     </script>

  2. #2
    Join Date
    Feb 2006
    Posts
    2,926
    It's a very simple technique, but when we learn it, we have to swear an oath of secrecy- sorry.

  3. #3
    Join Date
    Feb 2010
    Posts
    7
    Thanks mrhoo for wasting 3 seconds of my life by reading your reply.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles