Click here to Skip to main content
15,904,500 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
how to close the window using javascript in firefox and safari?
In IE below code is working,
but in firefox and safari does not work?

why does object xmlHttpRequest message come?


function CloseWindow() {
     
     var windowObj = window.self;
     windowObj.opener = window.self;
     windowObj.close();

   }
Posted
Updated 26-Nov-10 20:01pm
v2

I could have got the solution if you would done a Google search for - window.close firefox/safari.

Read this blog post: Mozilla firefox JavaScript window.close() not working / does not work in firefox[^]

This is for Firefox. I guess the methods given would work for Safari as well.
 
Share this answer
 
<code>document.close();</code> :-O
u can use it in asp.net by <code>request.write("&lt;script language='javascript'&gt; document.close(); &lt;/script&gt;");</code>
 
Share this answer
 
v3
Comments
Ankur\m/ 27-Nov-10 4:46am    
That would not even close the window in IE. STOP giving WRONG answers or else I will have to report it to the admins.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900