Skip to content

Instantly share code, notes, and snippets.

@jamigibbs
Last active June 11, 2019 22:16
Show Gist options
  • Save jamigibbs/70050c6fde78efc4c1e2ec1e571a41fb to your computer and use it in GitHub Desktop.
Save jamigibbs/70050c6fde78efc4c1e2ec1e571a41fb to your computer and use it in GitHub Desktop.
window.addEventListener("message", function(event) {
if (event.data.type === 'CAPTCHA-SITEKEY') {
sitekey = event.data.key;
hostURL = event.data.hostURL;
var gCaptchaScript = document.getElementById('g-captcha-script')
if (!gCaptchaScript) {
var script = document.createElement('script');
head = document.head || document.getElementsByTagName('head')[0];
script.src = `https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit`
script.id = 'g-captcha-script'
document.head.insertBefore(script, head.firstChild);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment