Skip to content

Instantly share code, notes, and snippets.

@hehe24h
Last active July 6, 2020 02:51
Show Gist options
  • Save hehe24h/acfa46c57bc4f37a5ca6814cb1652537 to your computer and use it in GitHub Desktop.
Save hehe24h/acfa46c57bc4f37a5ca6814cb1652537 to your computer and use it in GitHub Desktop.
(function () {
var param = 'fbclid';
if (location.search.indexOf(param + '=') !== -1) {
var replace = '';
try {
var url = new URL(location);
url.searchParams.delete(param);
replace = url.href;
} catch (ex) {
var regExp = new RegExp('[?&]' + param + '=.*$');
replace = location.search.replace(regExp, '');
replace = location.pathname + replace + location.hash;
}
history.replaceState(null, '', replace);
}
})();
//https://www.michalspacek.cz/zmena-url-a-skryvani-fbclid-pomoci-javascriptu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment