Last active
December 12, 2023 05:22
-
-
Save akku1139/24a6bcf459bd1b53a0803ed76a0906ed 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== | |
| // @name 絶対新しいタブで開かない | |
| // @namespace Violentmonkey Scripts | |
| // @match *://*/* | |
| // @grant none | |
| // @version 1.0 | |
| // @author - | |
| // @description 12/7/2023, 10:44:38 PM | |
| // ==/UserScript== | |
| window.open = function(url, target="", windowFeatures="") { | |
| location.href = url; | |
| } | |
| Array.from(document.getElementsByTagName("a")).forEach(e => { | |
| if(/_blank|_new|blank|new/.test(e.getAttribute("target"))) { | |
| e.removeAttribute("target"); | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment