Skip to content

Instantly share code, notes, and snippets.

@mherchel
Created May 9, 2019 01:49
Show Gist options
  • Save mherchel/25bca040c56aa9cf45b871be0751cbd9 to your computer and use it in GitHub Desktop.
Save mherchel/25bca040c56aa9cf45b871be0751cbd9 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Portal!</title>
</head>
<body>
<button>Click me to create a portal</button>
<script>
function createPortal() {
const portal = document.createElement('portal');
portal.src = 'https://www.lullabot.com';
document.body.append(portal);
portal.activate();
}
document.querySelector('button').addEventListener('click', createPortal);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment