Skip to content

Commit

Permalink
Merge pull request #240 from takluyver/download-ipynb-ajax
Browse files Browse the repository at this point in the history
Use window.location trick for download as ipynb
  • Loading branch information
minrk committed Jul 30, 2015
2 parents cf4341a + 9c2fdb7 commit 496289e
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions notebook/static/notebook/js/menubar.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,16 @@ define([
this.element.find('#download_ipynb').click(function () {
var base_url = that.notebook.base_url;
var notebook_path = that.notebook.notebook_path;
var w = window.open('');
var url = utils.url_join_encode(base_url, 'files', notebook_path)
+ '?download=1';
if (that.notebook.dirty) {
that.notebook.save_notebook({async : false});
that.notebook.save_notebook().then(function() {
w.location = url;
});
} else {
w.location = url;
}

var url = utils.url_join_encode(base_url, 'files', notebook_path);
window.open(url + '?download=1');
});

this.element.find('#print_preview').click(function () {
Expand Down

0 comments on commit 496289e

Please sign in to comment.