Example hosting: https://bl.ocks.org/ochafik/raw/ab740b275298928a3c44118c3a4c130a/?raw=true
Example image
Example hosting: https://bl.ocks.org/ochafik/raw/ab740b275298928a3c44118c3a4c130a/?raw=true
Example image
<body style="margin: 0; padding: 0; overflow: hidden"> | |
<iframe | |
id="content_frame" | |
frameborder="0" | |
style="overflow: hidden; height: 100%; width: 100%" | |
height="100%" | |
width="100%" | |
sandbox="allow-scripts"> | |
</iframe> | |
<script> | |
const contentFrame = document.getElementById('content_frame'); | |
const baseUrl = location.href.split('#')[0]; | |
const hash = location.hash || window.name; | |
if (hash.startsWith('#')) { | |
const content = decodeURIComponent(hash.substring(1)); | |
if (content.startsWith('data:')) { | |
contentFrame.src = content; | |
} else { | |
contentFrame.srcdoc = content; | |
} | |
history.replaceState(null, '', baseUrl); | |
window.name = hash; | |
} | |
</script> | |
</body> |