Created
February 13, 2019 02:54
-
-
Save joshmcarthur/114357808ff67a8729f3857ac18d3e6d to your computer and use it in GitHub Desktop.
IE9 Download Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>IE9 Download Example</title> | |
<script> | |
function legacyBrowserSave(content, filename) { | |
var frame = document.createElement("iframe"); | |
document.body.appendChild(frame); | |
frame.contentWindow.document.open("text/html", "replace"); | |
frame.contentWindow.document.write(content); | |
frame.contentWindow.document.close(); | |
frame.contentWindow.focus(); | |
frame.contentWindow.document.execCommand("SaveAs", true, filename); | |
document.body.removeChild(frame); | |
return false; | |
} | |
</script> | |
<body> | |
<button onClick="legacyBrowserSave('this,is,csv,content', 'example.csv')">Save file (<IE10 only)</button> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment