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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T11:55:54+00:00 2026-06-08T11:55:54+00:00

I have code which returns some other page (Google) in a popup (child) window.

  • 0

I have code which returns some other page (Google) in a popup (child) window. I cannot write any code in child window and so I have to do everything from the parent. I am trying to bind the onblur event from parent to the child window so that the child window should be closed once it lost the focus. However, the child window splash for a micro second and closes automatically.

I can’t use jQuery in the environment I am working.

Here is my sample code:

<html>
<head>
</head>

<body>
<input type="button" value="Open Google" onclick="OpenWindow()" />

<script type="text/javascript">

function OpenWindow()
{
    var url="http://www.google.com";

    var newWin=window.open(url, 'Popup','height=500,width=600,left=100,top=100,resizable=yes,scrollbars=no,toolbar=no,status=no');
    newWin.focus();
    newWin.onblur =  newWin.close();    
}
</script>

</body>
</html>
  • 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-08T11:55:55+00:00Added an answer on June 8, 2026 at 11:55 am

    Just skip the parenthesis behind .close()

    newWin.onblur = newWin.close;
    

    You want to pass a function reference, you don’t want to assign the value which gets returned by executing .close().

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

Sidebar

Related Questions

I have Epic Editor which returns a handle to the window (see Java code
I have the following code which definitely returns a proper data result if I
I have a piece of code which returns a Sales Order from AX. In
I have a dll in C# which returns a class object. DLL code: Person.cs:
I have the following code which takes a normal HTTP GET Request and returns
I have a UserControl that contains an UpdatePanel which wraps some other controls. The
I have one aspx page with some controls. Also i have one DIV which
I have this following code which will return all the current semesters. How do
I have a java code which gets the function names, their return types, their
I have a controller within MVC3 which needs to return a response code 500

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.