Created
July 24, 2011 05:11
-
-
Save ohnishiakira/1102273 to your computer and use it in GitHub Desktop.
外部リンクを自動で新しいタブで開く
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @match *://*/* | |
// ==/UserScript== | |
(function (anchors) { | |
for (var i = 0, l = anchors.length; i < l; i++) { | |
anchors[i].target = "_blank"; | |
} | |
})(document.querySelectorAll("a[href^='http']:not([href^='" + location.href + "'])")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
とりあえずCtrl(or Cmd)押しながらクリックすると別タブでバックグラウンドで開きますが、JavaScriptからやる方法はちょっと分からないですねえ...