We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2ea00a6 commit deda754Copy full SHA for deda754
share/jupyter/voila/templates/default/static/main.js
@@ -39,9 +39,12 @@ require(['static/voila'], function(voila) {
39
40
async function init() {
41
// it seems if we attach this to early, it will not be called
42
+ const matches = document.cookie.match('\\b_xsrf=([^;]*)\\b');
43
+ const xsrfToken = (matches && matches[1]) || '';
44
window.addEventListener('beforeunload', function (e) {
45
const xhttp = new XMLHttpRequest();
46
xhttp.open("DELETE", `/api/kernels/${kernel.id}`, false);
47
+ xhttp.setRequestHeader('X-XSRFToken', xsrfToken);
48
xhttp.send();
49
kernel.dispose();
50
});
0 commit comments