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

  • Home
  • SEARCH
  • 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 613969
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T18:03:40+00:00 2026-05-13T18:03:40+00:00

We have a client requirement that has stumped me, embarrassingly enough. The client has

  • 0

We have a client requirement that has stumped me, embarrassingly enough.

The client has a set of links that need to open in a popup window – if you click on any of the links, it should reuse the same popup window. Easy enough, I thought, so I threw something like this together:

<html>
<head>
    <title>Test</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 <script type="text/javascript">
        var popupWin = null;
        function openWindow(url) {
            if (popupWin == null) {
                popupWin = window.open(url,'p2p','');
            } else {
                if (!popupWin.closed) {
                    popupWin.location.href = url;
                } else {
                popupWin = window.open(url,'p2p','');
                }
            }
            popupWin.focus();
        }
    </script>
</head>
<body marginheight="0" marginwidth="0" leftmargin="0" topmargin="0" bgcolor="#ffffff">
    <ul>
<li><a href="http://www.google.com" target="p2p" onclick="openWindow(this.href);return false;">Google</a></li>
<li><a href="http://www.facebook.com" target="p2p" onclick="openWindow(this.href);return false;">FB</a></li>
<li><a href="http://www.apple.com" target="p2p" onclick="openWindow(this.href);return false;">Apple</a></li>
<li><a href="http://www.espn.com" target="p2p" onclick="openWindow(this.href);return false;">ESPN</a></li>
</ul>
</body>
</html>

If you put that into an html file, all behaves as expected.

My problem is that when I use the client’s intranet URLs per their requirement, the behavior I see is as follows:

  1. Click on one of the popup links (popup link opens in a new window)

  2. Click on another of the popup links (link replaces page opened in the first popup)

  3. Close the popup window.

  4. Click one of the popup links (doesn’t matter which, opens in a new popup window as
    expected)

  5. Click on another of the popup links (popup opens in a new popup window, not reusing the popup window as expected)

The weird thing is that if I step through the javascript code in Firebug, it correctly gets to the branch of the if statement that determines that the popup window exists and is not closed (so it should be reused), but the line of code:

popupWin.location.href = url;

Ends up opening a new window for some reason.

So, any idea what’s going on? I’m guessing something bizarre on the pages that the client wants me to popup is screwing things up in some mysterious fashion, but I can’t figure out what it is. Wish I could provide the links to you, but unfortunately they’re private.

Thanks much for any help.

Mustafa

  • 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-13T18:03:40+00:00Added an answer on May 13, 2026 at 6:03 pm

    Isn’t this functionality inherent in HTML? Shouldn’t it work without the javascript?

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

Sidebar

Ask A Question

Stats

  • Questions 387k
  • Answers 387k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Your instincts are correct. Use System.Web.Caching. The built-in cache management… May 15, 2026 at 12:14 am
  • Editorial Team
    Editorial Team added an answer Once you have the Cursor object, you can do something… May 15, 2026 at 12:14 am
  • Editorial Team
    Editorial Team added an answer Even if you're sending more data than that, it may… May 15, 2026 at 12:14 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.