File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes parent.window.close() is working only for IE Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "parent.window.close() is working only for IE" Watch "parent.window.close() is working only for IE" New topic
Author

parent.window.close() is working only for IE

Shashi Kala
Ranch Hand

Joined: Jan 27, 2008
Posts: 46
Hi all,

I have a hyper link i.e. 'logout'. When I click on it. the window should gets closed. To do so I wrote a javascript method as shown below.

function closing()
{
parent.window.close();
}
But this is working for only Internet Explorer..I have tried in Opera, Fire Fox, Netscape but in these browsers it is not working..I tried parent.parent.window.close() & top.window.close() functions too. But failed. Can anybody guess the problem here ??

With Regards,

Shashi Kala
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
It is browser security. If you did not create the window with window.open, you can not close it.

Eric
Shashi Kala
Ranch Hand

Joined: Jan 27, 2008
Posts: 46
Then, there is no other solution for this..
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61766
    
  67

Correct.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Shashi Kala
Ranch Hand

Joined: Jan 27, 2008
Posts: 46
Disappointed!! Thank you all.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61766
    
  67

Originally posted by Shashi Kala:
Disappointed!

Don't be. Just be glad that any old web site can't close your browser!
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
As Bear stated, I am glad that I do not go to some site and my browser just goes away. I would be a little ticked if that would happen.

Eric
Shashi Kala
Ranch Hand

Joined: Jan 27, 2008
Posts: 46
Yah!! I can be glad
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: parent.window.close() is working only for IE