Created
May 11, 2016 23:08
-
-
Save JosXa/b0b3fe41649750990079983c2b54da8c to your computer and use it in GitHub Desktop.
Userscript forcing all websites to open links in the same tab.
Useful for google, which seems to open a new tab every time you click a link.
This file contains 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== | |
// @name Open links in same tab | |
// @namespace | |
// @version 1.0 | |
// @description Description | |
// @require http://code.jquery.com/jquery-latest.js | |
// @include * | |
// ==/UserScript== | |
$(document).ready(function(){ | |
var a = document.getElementsByTagName("a"); | |
for (i=0;i<a.length;i++) { | |
if (a[i].target="_blank") { | |
a[i].target="_self" | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment