├── README.md ├── backgroundscript.js └── manifest.json /README.md: -------------------------------------------------------------------------------- 1 | Chrome Extension: Remove Affiliate Links 2 | ============================= 3 | 4 | Chrome extension to remove Amazon affiliate links. For those times when you really just want to browse without earning someone money for everything else you buy on Amazon. 5 | -------------------------------------------------------------------------------- /backgroundscript.js: -------------------------------------------------------------------------------- 1 | function remove_affiliate_links( details ) { 2 | if ( details.url.match( /&tag=[a-zA-Z0-9\-]*/ ) != null) { 3 | return { 4 | redirectUrl: details.url.replace( /(&tag=[a-zA-Z0-9\-]*)/, '' ) 5 | }; 6 | } 7 | } 8 | 9 | chrome.webRequest.onBeforeRequest.addListener( remove_affiliate_links, { urls: ["*://www.amazon.com/*", "*://www.amazon.co.uk/*", "*://amazon.com/*", "*://amazon.co.uk/*"] }, ["blocking"] ); 10 | -------------------------------------------------------------------------------- /manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "manifest_version": 2, 3 | "name": "Remove Affiliate Links", 4 | "description": "Removes Amazon affiliate codes from links", 5 | "version": "0.1", 6 | 7 | "permissions": [ 8 | "webRequest", 9 | "webRequestBlocking", 10 | "*://www.amazon.com/*", 11 | "*://www.amazon.co.uk/*", 12 | "*://amazon.com/*", 13 | "*://amazon.co.uk/*" 14 | ], 15 | 16 | "background": { 17 | "scripts": ["backgroundscript.js"], 18 | "persistent": true 19 | } 20 | } 21 | --------------------------------------------------------------------------------