Skip to content

Instantly share code, notes, and snippets.

@andreineculau
Created August 22, 2023 19:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andreineculau/d65e13ab5d0ebdd493c35ab4a2cd5b26 to your computer and use it in GitHub Desktop.
Save andreineculau/d65e13ab5d0ebdd493c35ab4a2cd5b26 to your computer and use it in GitHub Desktop.
Remove a.target usercript
// ==UserScript==
// @name Remove a.target
// @version 0.1
// @match http://*/*
// @match https://*/*
// @grant none
// @run-at document-idle
// ==/UserScript==
(function() {
'use strict';
var remove = () => {
[...document.querySelectorAll('a[target]')].forEach(function (a) {
self === top ? a.removeAttribute('target') : a.setAttribute('target', '_top');
});
}
window.setInterval(() => remove(), 5 * 1000);
remove();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment