From 1b5aea63dcf1c239f881bb45e3272f49669e863d Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Mon, 19 Aug 2019 14:58:13 +0200 Subject: [PATCH] Don't scroll to top of page when closing popin --- tarteaucitron.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tarteaucitron.js b/tarteaucitron.js index e480c63..b148301 100644 --- a/tarteaucitron.js +++ b/tarteaucitron.js @@ -767,7 +767,11 @@ var tarteaucitron = { "use strict"; if (document.location.hash === tarteaucitron.hashtag) { - document.location.hash = ''; + if (window.history) { + window.history.replaceState('', document.title, window.location.pathname + window.location.search); + } else { + document.location.hash = ''; + } } tarteaucitron.userInterface.css('tarteaucitron', 'display', 'none'); tarteaucitron.userInterface.css('tarteaucitronCookiesListContainer', 'display', 'none');