Skip to content

Instantly share code, notes, and snippets.

@Pickachu
Last active November 21, 2018 19:48
Show Gist options
  • Save Pickachu/219f1feca100f1d3c7a4263c32c0c8e3 to your computer and use it in GitHub Desktop.
Save Pickachu/219f1feca100f1d3c7a4263c32c0c8e3 to your computer and use it in GitHub Desktop.
Render Plunker on iFrame
<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
<script type="text/javascript">
const regex = /[?&]([^=#]+)=([^&#]*)/g,
url = window.location.href,
params = {};
var match;
while(match = regex.exec(url)) { params[match[1]] = match[2]; }
var src = `https://run.plnkr.co/plunks/${params.plunkerId}`;
var embed = `<iframe width="100%" height="100%" src="${src}" frameborder="0"></iframe>`;
document.write(embed);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment