Last active
September 15, 2019 02:19
-
-
Save y4rr/03c6b13b70db1129f48cead3aae51397 to your computer and use it in GitHub Desktop.
Link Target blank removal userscript - don't open links in new tabs
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== | |
// @name No New Tabs | |
// @match * | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
document.querySelectorAll('a[target]').forEach((link) => { | |
link.setAttribute('target', '_self'); | |
link.setAttribute('rel', 'noopener noreferrer'); | |
}); | |
document.querySelectorAll('base[target]').forEach((base) => { | |
base.setAttribute('target', '_self'); | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment