Skip to content

Instantly share code, notes, and snippets.

@ConradIrwin
Created May 18, 2015 21:46
Show Gist options
  • Select an option

  • Save ConradIrwin/da05a1ce99ee2cf4090b to your computer and use it in GitHub Desktop.

Select an option

Save ConradIrwin/da05a1ce99ee2cf4090b to your computer and use it in GitHub Desktop.
<body>
<script>
iframe = document.createElement('iframe')
iframe.setAttribute('sandbox', 'allow-same-origin');
blob = new Blob(['<body>'], {type: 'text/html'})
iframe.src = window.URL.createObjectURL(blob)
iframe.addEventListener('load', function () {
img = contentDocument.createElement('img')
img.src = "https://lh3.ggpht.com/O0aW5qsyCkR2i7Bu-jUU1b5BWA_NygJ6ui4MgaAvL7gfqvVWqkOBscDaq4pn-vkwByUx=w300-rw"
img.onload = function () {
alert('image loaded');
};
iframe.contentDocument.body.appendChild(img)
}, true)
document.body.appendChild(iframe)
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment