Solved

HOw to prevent "DO you wan to close this window" in IE.

Posted on 2011-09-20
5
218 Views
Last Modified: 2012-05-12
Hi,
  I am using IE. Iam opening a pop up from index.jsp. I want to close the parent window when I open child window. When I try to close parent with self.close()..it is showing a pop up with "DO you wan to close this window". Please let me know how can I prevent it using javascript. Please find the attached code for index.jsp.


Thank you
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head></head>
<script type="text/javascript" charset="utf-8">
function showLogin(){

	var strURL = "login.jsp";
	winPop = window.open(strURL,'name','height=375,width=415,left=150,top=200,toolbar=no,resizable=no,scrollbars=no');
	winPop.focus();
	self.close();

}
</script>
<body onload="showLogin()">

</body>
</html>

Open in new window

0
Comment
Question by:Sthokala
  • 3
  • 2
5 Comments
 
LVL 25

Expert Comment

by:Lee Savidge
ID: 36567895
Try this:

http://blogs.x2line.com/al/articles/350.aspx

It used to work..Not sure if it still does in the later versions of IE.
0
 

Author Comment

by:Sthokala
ID: 36567946
sorry it is not working..Please let me know how can I do it.
0
 
LVL 25

Expert Comment

by:Lee Savidge
ID: 36567957
Did you try the other posts in that page or did you try the one at the top only?
0
 

Author Comment

by:Sthokala
ID: 36567993
I tried the top and below code.
<html>
<head></head>
<script type="text/javascript" charset="utf-8">
function showLogin(){

	var strURL = "login.jsp";
	winPop = window.open(strURL,'name','height=375,width=415,left=150,top=200,toolbar=no,resizable=no,scrollbars=no');
	winPop.focus();
	window.close();

}
</script>
<body onload="window.opener='';showLogin()">

</body>
</html>

Open in new window

0
 
LVL 25

Accepted Solution

by:
Lee Savidge earned 500 total points
ID: 36568104
From what I can gather it is not possible due to security restrictions in IE. As I said in my initial post, I wasn't sure if it worked in later versions of IE. To be fair, I can understand why. If I had a load of tabs open in an IE window or Firefox window and then some page closed them all for me I would be pretty narked.

This isn't possible.

Lee
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…

758 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now