Skip to content

Commit

Permalink
Added On3 iframe
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshyPHP committed Mar 1, 2024
1 parent fa7734f commit 23f109e
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
36 changes: 36 additions & 0 deletions iframe/2/on3.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<!DOCTYPE html>
<title>Content from On3</title>
<body style="margin:0">
<script>
((document, window) =>
{
window.onload = () =>
{
document.body.innerHTML = `<iframe loading="eager" onload="contentWindow.postMessage('','*')" scrolling="no" src="//embed.on3.com/db/${location.hash.replace(/[^-\w]/g, '')}/industry-comparison/" style="border:0;height:100vh;width:100%"></iframe>`;
};

let height, port;
window.onmessage = (e) =>
{
e.stopImmediatePropagation();

if (e.data === 's9e:init' && !port)
{
port = e.ports[0];

return;
}

let m = /"height":([1-9]+\d*)/.exec(e.data);
if (m)
{
height = m[1];
}

if (height && port)
{
port.postMessage(height);
}
};
})(document, window);
</script>
1 change: 1 addition & 0 deletions iframe/2/on3.min.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!DOCTYPE html><title>Content from On3</title><body style=margin:0><script>((e,d)=>{d.onload=()=>{e.body.innerHTML=`<iframe loading=eager onload="contentWindow.postMessage('','*')" scrolling=no src="//embed.on3.com/db/${location.hash.replace(/[^-\w]/g,'')}/industry-comparison/" style=border:0;height:100vh;width:100%></iframe>`};let c,b;d.onmessage=a=>{a.stopImmediatePropagation();'s9e:init'!==a.data||b?((a=/"height":([1-9]+\d*)/.exec(a.data))&&(c=a[1]),c&&b&&b.postMessage(c)):b=a.ports[0]}})(document,window)</script>

0 comments on commit 23f109e

Please sign in to comment.