Something went wrong. Try again.
extremely simple firefox/chromium extension to copy current URL without tracking parameters
Something went wrong. Try again.
1234567891011121314151617181920212223242526const templates = { "youtube.com": ["v", "t", "start", "list", "index"], "google.com": ["q"], "bing.com": ["q"], "duckduckgo.com": ["q"], "wikipedia.org": ["title", "oldid", "diff"],};
chrome.action.onClicked.addListener(async (tab) => { if (!tab.url || !/^https?:/.test(tab.url)) return;
const url = new URL(tab.url); const template = Object.entries(templates).find( ([domain]) => url.hostname === domain || url.hostname.endsWith(`.${domain}`), )?.[1] || []; const parameters = [...url.searchParams]; url.search = ""; for (const [name, value] of parameters) { if (template.includes(name)) url.searchParams.append(name, value); }
await navigator.clipboard.writeText(url.href);});