Forked from azu/Medium: remove location hash.user.js
Created
October 29, 2020 19:24
-
-
Save marcelleblass/85bc5d9bfb78fb738c6886ee0578619b to your computer and use it in GitHub Desktop.
Medium: remove location hash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Medium: remove location hash | |
// @namespace http://efcl.info/ | |
// @description Remove location hash from medium | |
// @include https://medium.com/*#* | |
// @version 1 | |
// @grant none | |
// ==/UserScript== | |
function removeLocationHash(){ | |
var noHashURL = window.location.href.replace(/#.*$/, ''); | |
window.history.replaceState('', document.title, noHashURL) | |
} | |
window.addEventListener("popstate", function(event){ | |
removeLocationHash(); | |
}); | |
window.addEventListener("hashchange", function(event){ | |
event.preventDefault(); | |
removeLocationHash(); | |
}); | |
window.addEventListener("load", function(){ | |
removeLocationHash(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment