Welcome to the Bravenet Help Forums. Here you can chat and meet other Bravenet Members. Please do not post advertisements.
I'm looking for a code that works in Firefox. The code below works fine in IE. A web search turns up a lot of posts saying it can't be done but they are mostly very old (years). I'm hoping something new has come along that works.
< input value="Close Window" ="window.close()" type="button" >
Firefox, and most browsers, place restrictions on window closing. I know that Firefox will only let a script close a window that it has control of, which means that the script that tries to close it has to be the one that opened it.
If you want a workaround I'm sure there's plenty out there, but I would try to get an intermediary page that opens the page you're working with, and then you can pass a trigger back so that you can close it again (if that makes sense).
Thanks. I believe the page is set up like what you are saying, my website will have a page with a lyrics index. Click on individual titles and a page opens in a separate window with just lyrics of one song. I want to close this second page with the close button. I guess I just don't know enough to figure out how to do this.
Have a look at this page http://www.webreference.com/js/tutorial1/opener.html. You should be able to create a function on the page that opens the window. In that function do the lyricWindowName.close() code and you should be able to call that function from the lyrics window using the window.opener code.
Oh great! Thanks so much. Nice tutorial page.
It was just a google search, but I'm glad you've got it sorted.