Link to home
Start Free TrialLog in
Avatar of Sthokala
SthokalaFlag for United States of America

asked on

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

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

Avatar of Lee
Lee
Flag of United Kingdom of Great Britain and Northern Ireland image

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.
Avatar of Sthokala

ASKER

sorry it is not working..Please let me know how can I do it.
Did you try the other posts in that page or did you try the one at the top only?
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

ASKER CERTIFIED SOLUTION
Avatar of Lee
Lee
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial