Skip to content

Instantly share code, notes, and snippets.

@jeremylong
Created April 27, 2021 10:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeremylong/5325e353976a53f89128c69e20d36a55 to your computer and use it in GitHub Desktop.
Save jeremylong/5325e353976a53f89128c69e20d36a55 to your computer and use it in GitHub Desktop.
var existing = document.getElementsByTagName("script")[0];
var nonce = existing.getAttribute("nonce");
var newScript = document.createElement("script");
var att = document.createAttribute("nonce");
att.value = nonce;
newScript.setAttributeNode(att);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment