Posted By

nasso on 03/14/11


Tagged

javascript greasemonkey userscript


Versions (?)

greaseMonkey - Ajout script personnelle sur vos pages - Add your owner javascript in your html's code


 / Published in: JavaScript
 

  1. // ==UserScript==
  2. // @name Name of your script
  3. // @namespace
  4. // @include http://www.example.com/*
  5. // ==/UserScript==
  6.  
  7. var script = "http://localhost/yourscript.js";
  8.  
  9. if (typeof GM_addScript != "undefined") {
  10. GM_addScript(script);
  11. } else if (typeof GM_addScript != "undefined") {
  12. GM_addScript(script);
  13. } else {
  14. var heads = document.getElementsByTagName("head");
  15. if (heads.length > 0) {
  16. var node = document.createElement("script");
  17. node.type = "text/javascript";
  18. node.src = script
  19. // node.innerHTML = script;
  20. heads[0].appendChild(node);
  21. }
  22. }

Report this snippet  

You need to login to post a comment.