You could use history.replaceState and append the hash, to replace the current URI without triggering the hashchange event:
var newHash="test";
history.replaceState(null, null, document.location.pathname + '#' + newHash);
JSFiddle example
You could use history.replaceState and append the hash, to replace the current URI without triggering the hashchange event:
var newHash="test";
history.replaceState(null, null, document.location.pathname + '#' + newHash);
JSFiddle example