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


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.