I have a greasemonkey user script with this single line of code...
window.close();
but firefox does not allow a user script to close a window (as reported by an error message in the error console)
Is there a work around to this problem?
I have a greasemonkey user script with this single line of code...
window.close();
but firefox does not allow a user script to close a window (as reported by an error message in the error console)
Is there a work around to this problem?
You need to change configuration settings of Firefox (about:config) to allow this.
Now your script can close the TAB with 'window.close()'
eg.
function closeTab(){
window.open('', '_self', '');
window.close();
}
Since Firefox treats Greasemonkey code with the same privilages as the script code on external websites, it is not possible to only allow Greasemonkey code to be able to close the windows, but not regular scripts.