Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Bookmarklet to inject script by url to page, e.g. jquery.
javascript: (function() {
var url = prompt('URL of script to inject:', 'https://code.jquery.com/jquery-3.4.1.min.js');
if (url) {
console.log('Script inject request URL:', url);
var script = document.createElement('script');
script.src = url;
document.getElementsByTagName('head')[0].appendChild(script);
console.log('Injected script: ', script);
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment