about summary refs log tree commit diff
path: root/users/tazjin/nittredir/background.js
/**
 * 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']);