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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T15:15:02+00:00 2026-05-31T15:15:02+00:00

For example I’m on domain1: a.click(function(){ window.win=window.open(domain2,’name’); }); Now I’m on domain2 and I’m

  • 0

For example I’m on domain1:

a.click(function(){
  window.win=window.open(domain2,'name');
});

Now I’m on domain2 and I’m closing it. How will window.win know that user closed that window? Is there any event or property to check via interval?

  • 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-31T15:15:03+00:00Added an answer on May 31, 2026 at 3:15 pm

    There is a property which is not part of any W3C spec. It’s called closed and would get accessed like

    if( window.win.closed ) {
        // window was closed
    }
    

    I’m not sure about the cross-browser compatibilty for that property. I’m also not sure how this behaves on cross-origin domains. But if you try it please let me and the rest of this community know about it.


    Another option is that you take care for the notification yourself. That means, you are listening for the onbeforeunload within the popup-window. When the event fires, you could use HTML5’s postMessage method to communicate between cross-domain windows. For instance:

    MainWindow:

    window.addEventListener('message', function(e) {
        if( e.origin === 'http://www.popupdomain.com' ) {
            if( e.data === 'closed' ) {
                alert('popup window was closed');
            }
        }
    }, false);
    

    Domain2:

    window.onbeforeunload = function() {
        window.opener.postMessage('closed', 'http://www.popupdomain.com');
    };
    

    The only caveat on this solution is that it’s only compatible with browser that support basic HTML5. There are other (sneaky) ways to have a cross-domain communication on old’ish browsers, but I guess that is another story.

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

Sidebar

Related Questions

Example: var sessions = require('sessions'); function load_session(req) { sessions.load(sid); } Now that the session
Example: The user login to the webpage => Click on a button This action
Example class code: <?php class example { public function forExample() { return true; }
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
Example of function: call getThings(amount, place, limit, marginError) SYNOPSIS: CALL getThings(4, PA, 3, 1.2);
Example: Table: Unit ID NAME VALUE 1 Kilo 1000 2 Mega 1000000 3 Giga
Example of strings to search: name = 'bob' person=mary init= 'tim', first =sarah, ,name=o'donnel
Example RSS feed link: http://twitter.com/statuses/user_timeline/twitter.rss Does anyone know if Twitter limits calls to a
Example: function example($x = ) { Do something } Isn't $x empty by default
Example: var test = 'global value'; (function() { var test = 'local value'; //

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.