JavaScript: get and set variables in window.location.hash?
<p>Does anyone have a good solution for getting and setting variables in <code>window.location.hash</code>?</p>

<p>Take a URL that looks like this:</p>

<pre><code>domain.com/#q=1&amp;s=2
</code></pre>

<p>What I'd like is an unstressful way - JavaScript or jQuery -  to check the values of <code>q</code> and <code>s</code> when the page loads, and change them following events on the page.</p>

<p>I have found <a href="http://jquery-howto.blogspot.com/2009/09/get-url-parameters-values-with-jquery.html" rel="nofollow">some code for getting hash variables</a>, but nothing sensible for setting them. </p>

<p>Am I missing something really obvious, or do I need to roll my own solution (and release it!)?</p>

<p>Thanks.</p>
