user434770
user434770

Reputation: 181

Closing Firefox Window or current Tab Using Java Script

How can i close a Firefox Window or current Tab Using Java Script? I tried the following code, but it doesn't work....

window.close();

Please anyone help me!!!!

Upvotes: 1

Views: 3718

Answers (2)

Tim Büthe
Tim Büthe

Reputation: 63734

You only can close windows you have opened yourself and in most browsers the user will be prompted and ask for permisson, at least if the window has already a history.

var myWindow= window.open(address, "title", "width=300,height=400,left=100,top=200");
myWindow.close();

Upvotes: 1

oezi
oezi

Reputation: 51797

in JS, basically:

window.close();

or

self.close();

for more information, take a look at this and this.

Upvotes: 2

Related Questions