Relative Content

Tag Archive for javascripttampermonkeyintercept

Native JavaScript: Intercept and modify all link opening events

Problem Description There is a time-consuming async function f that takes a URL string and returns the modified one. For example: async function f(url) { // A dummy time-consuming function return new Promise((resolve, reject) => { setTimeout(() => { resolve(url + “#processed”); }, 1000) }); } I would like all links opened from a certain […]