File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
src/packages/jupyter/blobs Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,11 @@ import { decode } from "he";
13
13
//import { getLogger } from "@cocalc/backend/logger";
14
14
//const logger = getLogger("jupyter:blobs:iframe");
15
15
16
+ // We use iframes to render html in a number of cases:
17
+ // - if it starts with iframe
18
+ // - if it has a whole page doctype
19
+ // - if it has a <script> tag anywhere without a type -- since those are ignored by safe HTML
20
+ // rendering; using an iframe is the only way. This e.g., makes mpld3 work! https://github.com/sagemathinc/cocalc/issues/1934
16
21
export function is_likely_iframe ( content : string ) : boolean {
17
22
if ( ! content ) {
18
23
return false ;
@@ -23,7 +28,8 @@ export function is_likely_iframe(content: string): boolean {
23
28
content . includes ( "<!doctype html>" ) ||
24
29
( content . includes ( "<html>" ) && content . includes ( "<head>" ) ) ||
25
30
// special case "altair" inline html -- https://github.com/sagemathinc/cocalc/issues/4468
26
- content . includes ( 'id="altair-viz-' )
31
+ content . includes ( 'id="altair-viz-' ) ||
32
+ content . includes ( "<script>" )
27
33
) ;
28
34
}
29
35
You can’t perform that action at this time.
0 commit comments