Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2011-09-20
5
Medium Priority
?
253 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
[X]
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
  • 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 2000 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

Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

Question has a verified solution.

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

This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…

715 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