Skip to content

Instantly share code, notes, and snippets.

@joonahn
Created February 6, 2018 07:10
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 joonahn/cafbea9beed7b046131511810b69da33 to your computer and use it in GitHub Desktop.
Save joonahn/cafbea9beed7b046131511810b69da33 to your computer and use it in GitHub Desktop.
inject script with tampermonkey
// ==UserScript==
// @name New Userscript
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match http://targetsite.com/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
console.log("asdf");
(function(d, script) {
script = d.createElement('script');
script.type = 'text/javascript';
script.async = true;
script.onload = function(){
// remote script has loaded
};
script.src = 'http://yoursite.com/script.js';
d.getElementsByTagName('head')[0].appendChild(script);
}(document));
// Your code here...
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment