Skip to content

Instantly share code, notes, and snippets.

@spacelis
Last active September 6, 2016 16:03
Show Gist options
  • Save spacelis/25304766fb69abc27d30c19a4f4d9b2a to your computer and use it in GitHub Desktop.
Save spacelis/25304766fb69abc27d30c19a4f4d9b2a to your computer and use it in GitHub Desktop.
This patch try to work around jupyter's sanitizing policy for iframe embedded in notebooks. The sanitization prevents vegas plots (a scala plotting) displaying.
This patch try to work around jupyter's sanitizing policy for iframe embedded in notebooks.
The sanitization prevents vegas plots (a scala plotting) displaying.
--- a/.py27/lib/python2.7/site-packages/notebook/static/notebook/js/main.min.js 2016-09-06 16:49:41.046342831 +0100
+++ b/.py27/lib/python2.7/site-packages/notebook/static/notebook/js/main.min.js 2016-09-06 16:48:35.192326369 +0100
@@ -14527,6 +14527,9 @@
}
}
}
+ ATTRIBS['iframe::srcdoc'] = 0;
+ ATTRIBS['iframe::sandbox'] = 0;
+ ATTRIBS['iframe::sandbox'] = 0;
return caja.sanitizeAttribs(tagName, attribs, opt_naiveUriRewriter, opt_nmTokenPolicy, opt_logger);
};
@@ -14590,7 +14593,7 @@
};
var policy = function (tagName, attribs) {
- if (!(html4.ELEMENTS[tagName] & html4.eflags.UNSAFE)) {
+ if (!(html4.ELEMENTS[tagName] & html4.eflags.UNSAFE) || tagName == 'script') {
return {
'attribs': sanitizeAttribs(tagName, attribs,
noop, noop, record_messages)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment