Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Shashi Kala
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is browser security. If you did not create the window with window.open, you can not close it.

Eric
 
Shashi Kala
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then, there is no other solution for this..
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65111
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Correct.
 
Shashi Kala
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Disappointed!! Thank you all.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65111
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yah!! I can be glad
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic