How to close or kill an IE window with JavaScript.

Posted on 2013-01-25
Last Modified: 2013-01-25
When someone clicks a link on one of my pages I create a pop-up window with javascript called "theWindow". Sometimes this window will get lost behind other windows so if someone clicks another link on the page it will load that link in the other pop-up window but it will appear to them that nothing is happening since the original window is still up but behind the other windows. I'd like to put an onclick event before the current one to kill any pop-up windows. Could someone assist?
Question by:earwig75
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
LVL 18

Accepted Solution

nap0leon earned 500 total points
ID: 38819545
When you create the popup window, open it as an [object] that you can then reference in your "close me" function.
function OpenIt() {'popup');

function closeIt(){
	if (typeof childWindow != 'undefined') {

<a href="javascript:void(0);" onclick="OpenIt()">Open It</a><br/>
<a href="javascript:void(0);" onclick="closeIt()">Close It</a>

Open in new window


Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to create an extensible mechanism for linked drop downs.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses
Course of the Month10 days, 13 hours left to enroll

632 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question