Skip to content

Commit ca3e7a3

Browse files
authored
Merge pull request #3511 from nyu-ossd-s18/cookies
Displays Warning Message if Cookies Not Enabled
2 parents 87d010b + 9bc3f99 commit ca3e7a3

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

notebook/static/notebook/js/notebook.js

+11-4
Original file line numberDiff line numberDiff line change
@@ -3175,6 +3175,7 @@ define([
31753175
* @param {Error} error
31763176
*/
31773177
Notebook.prototype.load_notebook_error = function (error) {
3178+
var isSanitized = true;
31783179
this.events.trigger('notebook_load_failed.Notebook', error);
31793180
var msg;
31803181
if (error.name === utils.XHR_ERROR && error.xhr.status === 500) {
@@ -3187,6 +3188,11 @@ define([
31873188
console.warn('Error stack trace while loading notebook was:');
31883189
console.warn(error.stack);
31893190
}
3191+
if (navigator.cookieEnabled == false){
3192+
msg = i18n.msg._("Jupyter requires cookies to work; please enable cookies" +
3193+
" and refresh page. <a href=\"https://www.wikihow.com/Enable-Cookies-in-Your-Internet-Web-Browser\"> Learn more about enabling cookies. </a>");
3194+
isSanitized = false;
3195+
}
31903196
dialog.modal({
31913197
notebook: this,
31923198
keyboard_manager: this.keyboard_manager,
@@ -3198,9 +3204,10 @@ define([
31983204
click : function () {
31993205
window.close();
32003206
}
3201-
},
3202-
"Ok": {}
3203-
}
3207+
}
3208+
},
3209+
sanitize: isSanitized
3210+
32043211
});
32053212
};
32063213

@@ -3378,4 +3385,4 @@ define([
33783385
};
33793386

33803387
return {Notebook: Notebook};
3381-
});
3388+
});

0 commit comments

Comments
 (0)