• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Closing the window.

 
Krish Yeruva
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am trying to close the window by using
'<a href="javascript:window.close()">CLOSE</a>'
--By using this code, The opened window is getting closed in IE.
--But In FireFox, it is not getting closed.
Can anybody help me regarding this?
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you did not create the window with JavaScript with window.open() you are not allowed to close the window.

Eric
 
Krish Yeruva
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Eric,
I tried to open the new window by using
--<a href="http://www.copyright.gov/onlinesp/" target="_top">http://www.copyright.gov/onlinesp/</a>

This results like that hyperlink is getting opened in the new window. But i need to close the window by using the text link like-
<a href="javascript:self.close();">Close Window</a>

It is working fine in IE.. But not in FireFox.. Can you suggest me to close the window in FireFox also..??
 
Susan Smith
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<a href="javascript:self.close();">Close Window</a>


The above command should be work in Firefox.

Maybe you can use Firebug (Firefox plugin) to debug your pages.
Perhaps, you should consider that the problem is somewhere else that's affecting that part.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That link is opening up a new window, but that is really not a JavaScript window.

View the Error Console on Firefox: Tools--> Error Console -->Errors and see if there is an error listed in it.

If there is, you may have to do something like this:



That will use window.open to open the link, if they have JavaScript off, the link will work normal.

Eric
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic