Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Parse the current query string
- const url = new URL(window.location.href);
- const params = new URLSearchParams(url.search);
- // Modify the query parameters (example: adding/updating a parameter)
- params.set('key', 'value'); // Replace 'key' and 'value' with your desired key-value pair
- // Write the modified query string back to the URL
- url.search = params.toString();
- window.history.replaceState({}, '', url);
- // Now the URL in the browser's address bar is updated with the new query string
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement