Guest User

Untitled

a guest
Apr 23rd, 2013
127
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name       Always Open External Links In New Tab
  3. // @namespace  http://use.i.E.your.homepage/
  4. // @version    0.1
  5. // @description  enter something useful
  6. // @match      *://*/*
  7. // @copyright  2012+, You
  8. // ==/UserScript==
  9.  
  10. var nodeList = document.getElementsByTagName("a");
  11. for (var i=0; i<nodeList.length; i++) {
  12.     var link = nodeList[i];
  13.     if (link.href.indexOf(location.hostname) == -1)
  14.         link.target = "_blank";
  15. }
RAW Paste Data