Skip to content

Instantly share code, notes, and snippets.

@jakearchibald
Last active December 6, 2016 15:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jakearchibald/412a93e38d0b61642d52b3490136128b to your computer and use it in GitHub Desktop.
Save jakearchibald/412a93e38d0b61642d52b3490136128b to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<body>
<script>
(() => {
const iframe = document.createElement('iframe');
document.body.appendChild(iframe);
iframe.onload = () => {
iframe.contentDocument.write('<streaming-element>');
document.body.appendChild(
iframe.contentDocument.querySelector('streaming-element')
);
iframe.contentDocument.write('<script>console.log("Inline script")<\/script>');
iframe.contentDocument.write('<script src="script.js"><\/script>');
iframe.contentDocument.write('</streaming-element>');
iframe.contentDocument.close();
};
iframe.src = '';
})()
</script>
</body>
console.log('External script');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment