aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Closing the window. 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 "Closing the window." Watch "Closing the window." New topic
Author

Closing the window.

Krish Yeruva
Ranch Hand

Joined: Sep 17, 2008
Posts: 58
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?


Thanks & Regards
KITTU
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
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

Joined: Sep 17, 2008
Posts: 58
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

Joined: Oct 13, 2007
Posts: 224
<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

Joined: Nov 08, 2001
Posts: 15376
    
    6
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
 
Consider Paul's rocket mass heater.
 
subject: Closing the window.