I’m exploring my options for modifying urls in the browser bar for bookmarking purposes.
Ideally, I’d like to add querystring parameters and cannot determine if this is even possible. I don’t want the page to refresh and want to add querystring values on link clicks, ajax calls, etc.
If I can’t add querystring parameters, then I’d like to add hash values (http:://someurl.com#hash-value). How should I go about doing this? Should I use plain JavaScript or a framework (jquery, prototype, etc.) and/or framework plugin.
To modify the hash, you can simply do the following in plain JavaScript:
It will add
#hash-valueto your URL, or will replace it if it already exists, without refreshing the page.Then to check if a hash value is present, simply do the following: