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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

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']);