From 7cc55f530f58c191f16619247090fd855b6df07a Mon Sep 17 00:00:00 2001 From: ansuz Date: Thu, 24 Mar 2022 16:22:28 +0530 Subject: [PATCH] remove tracking URLs from document location --- www/common/cryptpad-common.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/www/common/cryptpad-common.js b/www/common/cryptpad-common.js index f183277e8..107000b5d 100644 --- a/www/common/cryptpad-common.js +++ b/www/common/cryptpad-common.js @@ -2610,6 +2610,16 @@ define([ }).nThen(function () { // Load the new pad when the hash has changed var oldHref = document.location.href; + + // remove tracking parameters from URLs + try { + var u = new URL(oldHref); + u.search = ''; + if (u.href !== oldHref) { + window.history.replaceState({}, window.document.title, u.href); + } + } catch (err) { console.error(err); } + window.onhashchange = function (ev) { if (ev && ev.reset) { oldHref = document.location.href; return; } var newHref = document.location.href;