Skip to content

Instantly share code, notes, and snippets.

@hemanth
Last active May 10, 2019 15:32
Show Gist options
  • Save hemanth/ebb6a2e01f10c515162b4af7efd91474 to your computer and use it in GitHub Desktop.
Save hemanth/ebb6a2e01f10c515162b4af7efd91474 to your computer and use it in GitHub Desktop.
Portal W3C test
<html>
<body>
<h1>Main</h1>
<button>Load portal</button>
</body>
<script>
document.querySelector('button').addEventListener('click', () => {
const portal = document.createElement('portal');
portal.src = 'http://localhost:3001';
document.body.appendChild(portal);
portal.activate();
});
</script>
</html>
<html>
<body>
<h1>Portal</h1>
</body>
<script>
window.addEventListener('portalactivate', (evt) => {
alert("here")
console.log({
adoptPredecessor: evt.adoptPredecessor()
})
});
</script>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment