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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T03:44:08+00:00 2026-06-11T03:44:08+00:00

so suppose I do this var myWindow = false; $(‘someelement’).click(function(){ var myWindow = window.open(‘url’,

  • 0

so suppose I do this

var myWindow = false;
$('someelement').click(function(){
  var myWindow = window.open('url', 'name', 'width=100,height=200');
});

so the user clicks on the element on window A and a new window (call it window B) is opened…

but then suppose window A gets reloaded…due to this, var myWindow is now set to false…but then window B is still open….how can I detect the existence of Window B from window A after window A gets reloaded

I know that you can do this:

var hasWindow = window.open('', 'name');

and it will return a reference to window B if it’s already open..

But then if window B is NOT opened yet, this will instead trigger a window opening, which is undesirable

How can I get a reference to window B if it’s open without triggering a new window opening in the event in which window B is not open? (without resorting to cookie tricks)

  • 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-11T03:44:10+00:00Added an answer on June 11, 2026 at 3:44 am

    The best way to keep a LITTLE bit of state without storing in cookies is to save something to your window.name. It’ll only work with a string, though, so you’ll need to save it as a JSON string if you want more than just a single bit of data.

    To read:

    var keptState;
    if (window.name !== "") {
        keptState = JSON.parse(window.name);
    }
    

    To write:

    state = {
        "popupOpened" : true,
        "popupName" : "otherWindowName"
    };
    window.name = JSON.stringify(state);
    

    On the other side of the refresh (or even navigating away from the site and back), it’ll keep your variables you wanted. If you actually wanted a reference to the other window, however, you’re on your own for that. I can’t think of any way to determine that it’s actually there. This would be a problem if, say, someone closed the popup window on their own.

    At least this way, you can find out if you’ve opened it. Then you could do a popunder if you really needed that window without the popup. This always feels a little shady when I do it, but it’s probably the best way to do what you’re asking for.

    var myWindow = window.open('', 'otherWindowName');
    myWindow.blur();
    window.focus();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have this jQuery code. $(document).delegate('a[title]', 'click', function(event) { var txt = //
Let's suppose I have a schema like this: var Person = new Schema({ name:
Suppose I have an array of objects like this: var nodes = [{size:8,name:myName},{size:10,name:otherName},{size:11,name:userName}]; How
Suppose this is a part of my django template: <div class=txt></div> <script> $(document).ready(function(){ var
Suppose we have this constructor: var Foo = function(){ this.x = y; } Foo
Suppose I get, on a page, this simple html/script : <a id=hey href=#>try</a> var
Suppose this is my URL route: (r'^test/?$','hello.life.views.test'), How do I make it so that
Suppose I have this setup: var whatever = new Array(); whatever[a] = new Array();
suppose I have this table var 10 3 4 60 70 and I want
Suppose I have a specific table selected in TinyMCE, like this: var ed =

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.