Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2011-09-20
5
Medium Priority
?
258 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 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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.
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
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…
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
Suggested Courses

876 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