tvl-depot/users/tazjin/nittredir/background.js

11 lines
332 B
JavaScript
Raw Normal View History

/**
* Register a URL change handler that redirects twitter.com links to nitter.net
*/
chrome.webRequest.onBeforeRequest.addListener(function(details) {
let url = new URL(details.url);
return {
redirectUrl: ('https://nitter.net' + url.pathname)
};
}, {urls: ['*://twitter.com/*'], types: ['main_frame']}, ['blocking']);