If all you are doing is adding a hash onto the existing URL, you should set location.hash
. Use pushState for changing the pathName without reloading the page.
UPDATE: history.js uses hashes in order to support older browsers. So passing in a hashed URL to history.js simply doesn't make sense (eg. what happens on older browsers?).
My suggestion is to use another query string parameter to hold the new URL. You will need to encode any path-like values:
var path2 = "/script_path/param1?more=params&even_more=params";
var newUrl = "/script_path/param1?get&file=html_file&path=" + encodeURI( path2 );
History.pushSate(null, null, newUrl);
... or you could take advantage of the API (no encoding needed):
var path2 = "/script_path/param1?more=params&even_more=params";
var newUrl = "/script_path/param1?get&file=html_file";
History.pushSate({path: path2}, null, newUrl);