Skip to content

Instantly share code, notes, and snippets.

@Pickachu
Last active November 19, 2018 17:54
Show Gist options
  • Save Pickachu/e81538d71cadc622994d5eb6400a1857 to your computer and use it in GitHub Desktop.
Save Pickachu/e81538d71cadc622994d5eb6400a1857 to your computer and use it in GitHub Desktop.
Genius Embedding in an Iframe format
<head></head>
<body>
<script>
const regex = /[?&]([^=#]+)=([^&#]*)/g,
url = window.location.href,
params = {};
var match;
while(match = regex.exec(url)) {
params[match[1]] = match[2];
}
var embed =`<div id='rg_embed_link_${params.songId}' class='rg_embed_link' data-song-id='${params.songId}'></div>`;
embed += `<script crossorigin src='//genius.com/songs/${params.songId}/embed.js'><\/script>`;
document.write(embed);
</script>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment