Created
May 7, 2022 09:31
-
-
Save dshoreman/b4144d0534bd8b862b2c5da3a3abc3f3 to your computer and use it in GitHub Desktop.
Tesco: Prevent ctrl-click hijacking
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 Tesco.com Click Fixer | |
// @namespace Violentmonkey Scripts | |
// @match https://www.tesco.com/* | |
// @grant none | |
// @version 1.0 | |
// @author - | |
// @description 07/05/2022, 09:32:38 | |
// ==/UserScript== | |
document.addEventListener('click', e => { | |
let t = e.target; | |
if (1 !== e.which || !e.ctrlKey || 'BUTTON' == t.tagName) { | |
return; | |
} | |
e.stopPropagation(); | |
e.preventDefault(); | |
if (t.tagName != 'A') { | |
t = t.closest('a'); | |
} | |
window.open(t.href, '_blank'); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment