OctoSpaccHub/source/FramesBrowser/html-data-url-loader.html

35 lines
904 B
HTML

<!DOCTYPE html>
<html>
<head>
<script src="./utils.js"></script>
</head>
<body>
<script>(function(){
//window.addEventListener('load', (function(){
var [mime, body] = extractDataUrl(location.hash.slice(1)/*.split('#').slice(2).join('#')*/);
var dom = (new DOMParser).parseFromString(body, mime);
document.documentElement.innerHTML = dom.documentElement.innerHTML;
document.head.innerHTML = dom.head.innerHTML;
document.body.innerHTML = dom.body.innerHTML;
// hydrate scripts; TODO handle all attributes to copy
Array.from(document.querySelectorAll('script')).forEach(function(oldScriptEl){
newScriptEl = Object.assign(document.createElement('script'), {
id: oldScriptEl.id,
className: oldScriptEl.className,
innerHTML: oldScriptEl.innerHTML,
});
if (oldScriptEl.src) {
newScriptEl.src = oldScriptEl.src;
}
oldScriptEl.replaceWith(newScriptEl);
});
//}));
})();</script>
</body>
</html>