use replaceState if available, instead of setting the hash

pull/1/head
ansuz 8 years ago
parent 67bf41627d
commit 303c65f2c3

@ -495,9 +495,7 @@ define([
}
// set the hash
if (!readOnly) {
window.location.hash = editHash;
}
if (!readOnly) { Cryptpad.setHash(editHash); }
Cryptpad.getPadTitle(function (err, title) {
if (err) {

@ -225,6 +225,14 @@ define([
return secret;
};
var setHash = common.setHash = function (hash) {
if (!/^#/.test(hash)) { hash = '#' + hash; }
if (window.history && window.history.replaceState) {
return void window.history.replaceState({}, window.document.title, hash);
}
window.location.hash = hash;
};
var storageKey = common.storageKey = 'CryptPad_RECENTPADS';
/*

@ -601,9 +601,7 @@ define([
}
// set the hash
if (!readOnly) {
window.location.hash = editHash;
}
if (!readOnly) { Cryptpad.setHash(editHash); }
Cryptpad.getPadTitle(function (err, title) {
if (err) {

@ -914,9 +914,7 @@ define([
editHash = Cryptpad.getEditHashFromKeys(info.channel, secret.keys);
}
// set the hash
if (!readOnly) {
window.location.hash = editHash;
}
if (!readOnly) { Cryptpad.setHash(editHash); }
module.patchText = TextPatcher.create({
realtime: realtime,

@ -585,7 +585,7 @@ define([
// set the hash
if (!window.location.hash || window.location.hash === '#') {
window.location.hash = editHash;
Cryptpad.setHash(editHash);
}
Cryptpad.getPadTitle(function (err, title) {

Loading…
Cancel
Save