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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T04:36:59+00:00 2026-06-07T04:36:59+00:00

Is there a way in jQuery that I can detect a closed tab in

  • 0

Is there a way in jQuery that I can detect a closed tab in my base app and make it refresh the page?

I built a ticketing system. When you click a ticket, it uses target=”_blank” to open the ticket in a new tab. When you update a ticket (and only when you do so), and then click “Close Tab” link, I would like the main app (the previous tab) to recognize this event and automatically refresh the page.

I know that I can use window.open() and then detect a closed handle on a loop, but it’s inelegant because on the IEs it doesn’t open in a new tab sometimes and instead opens a new window. With target=”_blank”, I think I’m seeing that the IEs open a new tab. I prefer tabs.

  • 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-07T04:37:01+00:00Added an answer on June 7, 2026 at 4:37 am

    So we have a parent tab with the ticket table, and then a child tab where we have an actual ticket. It’s not truly a parent/child relationship, however, because I’m using target=”_blank” clicks instead of window.open() events.

    The fix is kind of a kludge, but it works. The changes only need to be added to the “parent” tab. First, add a gbRefreshStale global boolean in Javascript to the page and set its value to 0 like so:

    var gbRefreshStale = 0;
    

    Second, on each target=”_blank” click, intercept with jQuery like so:

    $('A[target=_blank]').click(function(){
      setTimeout('gbRefreshStale=1;clearTimeout();',500);
      return true;
    });
    

    Then, third, you’ll need this mouseenter event for the header of the page:

    $('#header').mouseenter(function(){ 
      // assuming you called your banner/header as #header
      if (gbRefreshStale) {
        gbRefreshStale = 0;
        location.href = location.href;
      }
    });
    

    The effect here is that a new tab is opened for the ticket, but if someone closes that tab and passes their mouse across the header (which they will likely do since they just closed a child tab), the parent tab will refresh. This also works if multiple tabs are opened and closed, and this system prevents the parent tab from being refreshed in a loop. The timeout is necessary because otherwise someone’s mouse might cross the #header section of the parent before that tab opens.

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

Sidebar

Related Questions

Is there a way using JQuery that i can detect when a div starts
I've read that there is no way that JQuery can download a file directly,
Is there any way that I can use JavaScript (and jQuery) to create a
I know that there is no way of auto adding the JQuery Mobile App
When writing a new jQuery plugin is there a straightforward way of checking that
How do you check if there is an internet connection using jQuery? That way
Is there a way with JQUERY or Javascript, to detect anytime the browser window
Is there a way to check if jQuery fired the page load events yet,
In my app I have jquery that is specific to each page, that is
I have a jquery mobile app that has a page. This page has three

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.