Skip to content

Instantly share code, notes, and snippets.

@mbifulco
Created November 16, 2021 17:07
Show Gist options
  • Save mbifulco/90db16e052d03f7447fe34e862d37a27 to your computer and use it in GitHub Desktop.
Save mbifulco/90db16e052d03f7447fe34e862d37a27 to your computer and use it in GitHub Desktop.
How to set url search params without navigating
const url = new URL(window.location);
url.searchParams.set('h', 100); // add hue value here
url.searchParams.set('s', 0); // add s value here
url.searchParams.set('v', 0); // add v value here
// tell the browser to update the URL
window.history.pushState({}, '', url);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment