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 6207443
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T05:37:52+00:00 2026-05-24T05:37:52+00:00

Is there a way to redirect the window or tab when a user closes

  • 0

Is there a way to redirect the window or tab when a user closes it? This does not work (in jQuery):

$(window).bind('beforeunload', function() {
   window.location = 'anotherpage.html'
}

Is it even possible? I just want to redirect a user to another page when they close it.

  • 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-05-24T05:37:53+00:00Added an answer on May 24, 2026 at 5:37 am

    No, the only thing you can do is alert the user they are about to close your page and ask them if they would like to remain or confirm to leave.

    This is very common on pages which require you to save before exiting, like an online exam or survey for example.

      window.onbeforeunload = confirmExit;
      function confirmExit()
      {
          return "You have attempted to leave this page.  If you have made any changes to the fields without clicking the Save button, your changes will be lost.  Are you sure you want to exit this page?";
      }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a way to using a JQuery function to programmatically create an event
Is there a way to redirect all traffic to my website to a specific
Is there a way to redirect output of an executing PHP script? Of course
Is there a way to reload a page using prototype (or redirect to itself)?
Is there a way using jQuery or Javascript to force a page to open
I was wondering if there was a way to do a redirect inside a
Is there a way to redirect from my Facebook canvas page to my external
Is there any way to cause a page to redirect without having to use
Python's urllib2 follows 3xx redirects to get the final content. Is there a way
Is there way in next piece of code to only get the first record?

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.