From 7e4c1238ba170ff522d36e6e260c486e24fa9df4 Mon Sep 17 00:00:00 2001 From: ed Date: Thu, 4 Mar 2021 21:12:54 +0100 Subject: [PATCH] oh --- copyparty/web/browser.js | 4 ++-- copyparty/web/util.js | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/copyparty/web/browser.js b/copyparty/web/browser.js index 6ff78e6e..f07b0c98 100644 --- a/copyparty/web/browser.js +++ b/copyparty/web/browser.js @@ -462,7 +462,7 @@ function play(tid, call_depth) { o.setAttribute('id', 'thx_js'); if (window.history && history.replaceState) { var nurl = (document.location + '').split('#')[0] + '#' + oid; - hist_push(ebi('files').innerHTML, nurl); + hist_replace(ebi('files').innerHTML, nurl); } else { document.location.hash = oid; @@ -971,7 +971,7 @@ function autoplay_blocked() { if (window.history && history.pushState) { var u = get_vpath() + window.location.hash; - hist_push(ebi('files').innerHTML, u); + hist_replace(ebi('files').innerHTML, u); } })(); diff --git a/copyparty/web/util.js b/copyparty/web/util.js index 02ea61a3..1f79c4e6 100644 --- a/copyparty/web/util.js +++ b/copyparty/web/util.js @@ -299,3 +299,9 @@ function hist_push(html, url) { sessionStorage.setItem(key, html); history.pushState(key, url, url); } + +function hist_replace(html, url) { + var key = new Date().getTime(); + sessionStorage.setItem(key, html); + history.replaceState(key, url, url); +}