about summary refs log tree commit diff
path: root/users/tazjin/nittredir/background.js
blob: 8d07f852852065ca8c73fecd7736362586900c1c (plain) (blame)
1
2
3
4
5
6
7
8
9
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']);