From 1123af8528e2cbca7add7e8960d6307b80928355 Mon Sep 17 00:00:00 2001 From: Paul Ivanov Date: Mon, 21 Oct 2013 11:49:13 -0700 Subject: [PATCH] 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 --- IPython/html/static/notebook/js/menubar.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/IPython/html/static/notebook/js/menubar.js b/IPython/html/static/notebook/js/menubar.js index 38a67b9dc..766acfa19 100644 --- a/IPython/html/static/notebook/js/menubar.js +++ b/IPython/html/static/notebook/js/menubar.js @@ -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 () {