2 ms·
Here a version that works for cross origin requests. <iframe hidden name=xhtmz onload="onmessage=x=>document.querySelector(x.data.target).innerHTML=x.data.co
by h43z 3y ago
Here a version that works for cross origin requests.
<iframe hidden name=xhtmz onload="onmessage=x=>document.querySelector(x.data.target).innerHTML=x.data.content"></iframe>
but website you are requesting has to embed the below script tag.
<u id=t>just some other text</u>
<script>
parent.postMessage({
target:location.hash,
content:b.outerHTML
},'*')
</script>
You would still set the DOM destination on the main page.
<a href="https://xorigin.com#view" target=xhtmz>dog</a>
<div id=view></div>
- chatmasta 3y agoCareful with that snippet, targetOrigin of * is dangerous. I could embed your iframed content on my own site and then you'd happily send me the entire HTML inside the iframe.