You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
I really need some help with this matter. I work with an aplication that's got a "viewer" for the pages or activities that I make. So whatever I do is oppened through this viewer.
The viewer gets an ID (which I don't know what will be). So I want to create a button that will close the window of the viewer. I get the ID of the window first:
var itsMe
function whoAreYou(){
itsMe = window.name
}
and with the name of the window, I call this function that is supposed to close the window:
Unless something has changed very recently the code to close a window is:
Code:
window.close();
Note that, in modern browsers, this only works if you have opened the window via script, it DOESN'T work on windows opened by the user in a normal fashion.