diff options
Diffstat (limited to 'users/tazjin/nittredir/background.js')
-rw-r--r-- | users/tazjin/nittredir/background.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/users/tazjin/nittredir/background.js b/users/tazjin/nittredir/background.js new file mode 100644 index 000000000000..8d07f8528520 --- /dev/null +++ b/users/tazjin/nittredir/background.js @@ -0,0 +1,10 @@ +/** + * 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']); |