Skip to content

Instantly share code, notes, and snippets.

@elbywan
Last active November 6, 2018 13:21
Show Gist options
  • Save elbywan/2d73c7e27d0df8dfe193dbd440cb845c to your computer and use it in GitHub Desktop.
Save elbywan/2d73c7e27d0df8dfe193dbd440cb845c to your computer and use it in GitHub Desktop.
// Assume that this code is executed inside the mutation observer callback:
addedNodes.forEach(node => {
// See above for script tag checks…
// Blocks the script tag execution in Safari, Chrome, Edge & IE
node.type = 'javascript/blocked'
// Unnecessary, but cleaner: remove the node from the DOM
node.parentElement.removeChild(node)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment