Skip to content

Instantly share code, notes, and snippets.

@yahelc
Created January 27, 2015 23:02
Show Gist options
  • Save yahelc/6b1fd69769822550f88b to your computer and use it in GitHub Desktop.
Save yahelc/6b1fd69769822550f88b to your computer and use it in GitHub Desktop.
Bookmarklet to make current URL the canonical URL (or strip out the query string and anchor if there's no canonical URL)
javascript:var c = document.querySelector("link[rel=canonical]") || location.pathname; if(c){ history.replaceState({},document.title, c); }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment