Skip to content

Instantly share code, notes, and snippets.

@jiji262
Created March 3, 2017 08:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jiji262/6d6b0873fbe0dd5bea92e68a794ca15d to your computer and use it in GitHub Desktop.
Save jiji262/6d6b0873fbe0dd5bea92e68a794ca15d to your computer and use it in GitHub Desktop.
remove Medium sites location hash (script for tampermonkey)
// ==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