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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:23:03+00:00 2026-06-11T16:23:03+00:00

From my main app page, Default.aspx I am popping up another page with window.open

  • 0

From my main app page, Default.aspx I am popping up another page with window.open.
On that page I have a home link as a HyperLink that calls a Javascript function.

<asp:HyperLink id="lnkHome" runat="server" meta:resourcekey="lnkHome" NavigateUrl = " " onclick = "javascript:performRedirect()">

I am checking if the parent window is still running and if it is just closing this window, If not then redirecting back to the main window.

function performRedirect() {
    if (parentExists()) {

        $("a[id$= lnkHome]").attr('href', 'window.close();');
    }
    else {

        $("a[id$= lnkHome]").attr('href', 'Default.aspx');
    }
}
function parentExists() {

    return (window.parent.location === window.location) ? false : true;
}

It works, but for some reason check fails and it always redirects me to Default.aspx even if calling page is still open. What do I need to change here? Unfortunately I have to use HyperLink control. I am using ASP.NET 4.0

  • 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-11T16:23:04+00:00Added an answer on June 11, 2026 at 4:23 pm

    I would check for window.opener instead of window.parent since you are opening the window using window.open

    Your parentExistis func become this:

    function parentExists() { 
        return window.opener!==null;
    }
    

    Or…

    function parentExists() { 
        return window.opener!==null && window.opener.location.href===window.location.href;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an app that opens a non-modal form from the main form. The
I have a small app that when button presses navigates when moving from main
I'd like to create another app from my main app, for instace 'app with
We have App A as main app. Now we build from it App B
I just copied an example from AndEngine main page, but the app is always
I need to move a folder from a plugin to the main app/views. I
i'm trying to pass a string from main to another function. this string is
I have 2 classes 'Main' and 'FOR'. From 'Main' I will call method 'display'
Scenario: I start out in my app's main page. I navigate to sub-page A,
I have a MVC3 application, based on default layout from VS 2010, which I

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.