Skip to content

Commit

Permalink
Add support for IE 11 for markup slices (#3702)
Browse files Browse the repository at this point in the history
* Add srcdoc-polyfill tosupport Internet Explorer iframes in markup slices. Add allow-top-navigation and allow-popups to support links within iframes

* Remove jquery from markup.js
  • Loading branch information
Jay Lindquist authored and mistercrunch committed Oct 23, 2017
1 parent fa07b8d commit b4bdc45
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
3 changes: 2 additions & 1 deletion superset/assets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@
"classnames": "^2.2.5",
"d3": "^3.5.17",
"d3-cloud": "^1.2.1",
"d3-hierarchy": "^1.1.5",
"d3-sankey": "^0.4.2",
"d3-svg-legend": "^1.x",
"d3-tip": "^0.6.7",
"d3-hierarchy": "^1.1.5",
"datamaps": "^0.5.8",
"datatables.net-bs": "^1.10.15",
"distributions": "^1.0.0",
Expand Down Expand Up @@ -93,6 +93,7 @@
"redux-thunk": "^2.1.0",
"shortid": "^2.2.6",
"sprintf-js": "^1.1.1",
"srcdoc-polyfill": "^1.0.0",
"supercluster": "https://github.com/georgeke/supercluster/tarball/ac3492737e7ce98e07af679623aad452373bbc40",
"urijs": "^1.18.10",
"viewport-mercator-project": "^2.1.0"
Expand Down
11 changes: 7 additions & 4 deletions superset/assets/visualizations/markup.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const $ = require('jquery');
const srcdoc = require('srcdoc-polyfill');

require('./markup.css');

Expand All @@ -23,9 +23,12 @@ function markupWidget(slice, payload) {
<iframe id="${iframeId}"
frameborder="0"
height="${slice.height()}"
sandbox="allow-scripts">
</iframe>`);
$('#' + iframeId)[0].srcdoc = html;
sandbox="allow-same-origin allow-scripts allow-top-navigation allow-popups">
</iframe>
`);

const iframe = document.getElementById(iframeId);
srcdoc.set(iframe, html);
}

module.exports = markupWidget;
2 changes: 1 addition & 1 deletion superset/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ def load_birth_names():
<h1>Birth Names Dashboard</h1>
<p>
The source dataset came from
<a href="https://github.com/hadley/babynames">[here]</a>
<a href="https://github.com/hadley/babynames" target="_blank">[here]</a>
</p>
<img src="/static/assets/images/babytux.jpg">
</div>
Expand Down

0 comments on commit b4bdc45

Please sign in to comment.