[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

window.close() do NOT work on FireFox..

Posted on 2006-11-24
6
Medium Priority
?
2,210 Views
Last Modified: 2009-05-29
I used the following code to close window. It works on I.E, but not FireFox. How can I resolve a problem??

<FORM>
<INPUT TYPE="button" VALUE="LogOut" onClick="window.close()">
</FORM>
0
Comment
Question by:portal123
[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
6 Comments
 
LVL 17

Expert Comment

by:Cem Türk
ID: 18010158
its a security issue with FF you cant close a window except it is a pop-up window (that opened by window.open method)
0
 
LVL 3

Assisted Solution

by:Masoudgh
Masoudgh earned 640 total points
ID: 18010785
0
 
LVL 23

Accepted Solution

by:
rama_krishna580 earned 680 total points
ID: 18012041
Hi,

1. Copy/paste the following code to the head of your page…

<script language="javascript" type="text/javascript">

function closeWindow() {

window.open('','_parent','');

window.close();

}

</script>

2. Set your link like this:

<a href="javascript:closeWindow();">Close Window</a>

R.K
0
Technology Partners: 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!

 
LVL 3

Assisted Solution

by:jay_gadhavi
jay_gadhavi earned 680 total points
ID: 18026346

This code works in both IE and FF ----

<html>

<head>
<SCRIPT language="JavaScript">
<!--
var browserName=navigator.appName;
if (browserName=="Netscape") {

function closynoshowsme()
{
window.open('','_parent','');
window.close();}
}
else {
if (browserName=="Microsoft Internet Explorer")
{
function closynoshowsme()
{
window.opener = "whocares";
window.close();
}
}
}

//-->
</SCRIPT>

</head>

<body>
<a href="javascript: closynoshowsme();">Close Window</a><br /><br /><br />
<button type="button" onclick="closynoshowsme();">Close this window</button>
</body>
</html>

0
 

Expert Comment

by:JRevathi
ID: 22958661
I tried the above code.. it is not working for FF.........
window.close(); works for only pop-up windows..

Thanks
Bhanu Prakash
0
 

Expert Comment

by:swist
ID: 24501295
As far as I tested, easiest way to close window for most browsers (including ff2 & ff3, without need for changing browser conf.) is this:


<input type="button" name="Close" 
onclick="window.opener = window.self; window.close();" />

Open in new window

0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
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…

649 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