xrforge-v2/src/page/index.html

22 lines
724 B
HTML

${header}
<iframe border="0" frameborder="0" src="/janusweb/index.html#janus.url=${url}" id="viewer"></iframe>
<script>
// minimal JS to sync parent/iframe URL-locations
const iframe = document.querySelector("#viewer")
iframe.addEventListener('load', () => {
const iframeWindow = iframe.contentWindow;
iframeWindow.addEventListener('hashchange', (event) => {
const params = new URLSearchParams( String(iframeWindow.location.hash).replace(/^#/,'?') )
const url = params.get('janus.url')
window.history.pushState( url, iframe.contentDocument.title, url );
setTimeout( () => {
document.title = iframe.contentDocument.title
}, 1000 )
});
});
</script>
${footer}