Skip to content

Node.js based forum software built for the modern web

closes #3621

barisusaklie461615c1a54
diff --git a/public/src/client/topic.js b/public/src/client/topic.js
index 1e2c56d887..98a9661f16 100644
--- a/public/src/client/topic.js
+++ b/public/src/client/topic.js
@@ -247,13 +247,19 @@ define('forum/topic', [
}
if (newUrl !== currentUrl) {
- if (history.replaceState) {
- var search = (window.location.search ? window.location.search : '');
- history.replaceState({
- url: newUrl + search
- }, null, window.location.protocol + '//' + window.location.host + RELATIVE_PATH + '/' + newUrl + search);
+ if (Topic.replaceURLTimeout) {
+ clearTimeout(Topic.replaceURLTimeout);
}
- currentUrl = newUrl;
+ Topic.replaceURLTimeout = setTimeout(function() {
+ Topic.replaceURLTimeout = 0;
+ if (history.replaceState) {
+ var search = (window.location.search ? window.location.search : '');
+ history.replaceState({
+ url: newUrl + search
+ }, null, window.location.protocol + '//' + window.location.host + RELATIVE_PATH + '/' + newUrl + search);
+ }
+ currentUrl = newUrl;
+ }, 500);
}
}
return index;