Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!doctype html>
<title>Adopt img from image document</title>
<link rel="match" href="document-base-url-ref.html">
<!-- Counteract any style added by the image document -->
<style>img { width: initial; height: initial; }</style>
<iframe></iframe>
<script>
var iframe = document.querySelector('iframe');
iframe.onload = function() {
let img = iframe.contentDocument.body.firstChild;
document.body.appendChild(img);
iframe.remove();
};
iframe.src = 'resources/cat.jpg';
</script>