Usually I try to avoid window.location.hash due to the fact that it is not homogeneous in different browsers.
So instead of doing the following
window.location.hash = "some hash value";
I would do
window.location.href = window.location.href.split("#")[0] + "#" + encodeURIComponent("some hash value");
Also, although Firefox shows a decoded hash in the address bar (i.e., '' instead of% 20), if you try to copy the address, it is actually encoded. Thus, what is displayed does not match what is in the URI.
As an aside, I always access the hash using the following code
var hash_val = window.location.href.split("#")[1] || "";
source share