Forked from azu/Medium: remove location hash.user.js
Created
December 22, 2020 11:41
-
-
Save abdullahceylan/7891cb9d51bef2a5bc8d6e4bb15ae71c 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