Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Yes, that's fair. Indeed my so called improvement requires continual maintenance to add new parameters to the blocklist, which somewhat defeats what is perhaps the main purpose: convenience.

While it is clear that your solution works well for you and would probably work for me too for most types of 'bad' URLs, I am noting down an allowlist based solution for my own satisfaction and future reference:

  javascript:(()=>{const u=new URL(location.href);[...u.searchParams.keys()].forEach(k=>{if(!['p','q'].includes(k)){u.searchParams.delete(k)}});navigator.clipboard.writeText(u.href)})();
Tested with the following URL:

  https://duckduckgo.com/?ia=web&origin=funnel_home_website&t=h_&q=hello+world&chip-select=search
The bookmarklet copies this cleaned version of the URL:

  https://duckduckgo.com/?q=hello+world


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: