Last active
November 19, 2018 17:54
-
-
Save Pickachu/e81538d71cadc622994d5eb6400a1857 to your computer and use it in GitHub Desktop.
Genius Embedding in an Iframe format
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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