make close-and-halt work on new tabs in Chrome

this is not possible in Firefox, as new tabs/windows which were *not*
opened via a script ( window.open call ) are not allowed to be closed
via window.close and will yield a message like

--
[11:50:59.691] Scripts may not close windows that were not opened by script. @ http://localhost:8888/static/notebook/js/menubar.js:105
This commit is contained in:
Paul Ivanov 2013-10-21 11:49:13 -07:00
parent 57fa14a2fa
commit 1123af8528

View File

@ -131,7 +131,11 @@ var IPython = (function (IPython) {
});
this.element.find('#kill_and_exit').click(function () {
IPython.notebook.session.delete();
setTimeout(function(){window.close();}, 500);
setTimeout(function(){
// allow closing of new tabs in Chromium, impossible in FF
window.open('', '_self', '');
window.close();
}, 500);
});
// Edit
this.element.find('#cut_cell').click(function () {