ea9982d9ea
There is another extension for this already, but it hooks in after the page has already started loading - doing it on the URL change handler is much faster. Change-Id: I442552cbd8bb040df999a1624cafd436f4a7b875 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2430 Reviewed-by: tazjin <mail@tazj.in> Tested-by: BuildkiteCI
10 lines
332 B
JavaScript
10 lines
332 B
JavaScript
/**
|
|
* 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']);
|