Guest User

Untitled

a guest
Mar 22nd, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. // This way didn't work.
  2. // Cause this custom.js or nbextensions files will be loaded after initializing JupyterNotebookApp.
  3. // It means this code won't affect to it's initializing Ajax requests.
  4.  
  5. // Sending token on each XHRs too.
  6. // Because Safari won't handle Cookie and localStorage
  7. // on iframes.
  8. // Jupyter Client expects it's cookie, so it will be forbidden
  9. // Instead, sending "token" by manually on each XHRs.
  10.  
  11. // Retrieving token from data attribute
  12. // Because Jupyter Notebook will delete ?token param automatically.
  13. var token = document.querySelector('body').dataset.jupyterApiToken || '';
  14. jQuery.ajaxSetup({
  15. headers: {"Authorization": 'token ' + token}
  16. });
Add Comment
Please, Sign In to add comment