Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Medium: remove location hash
// ==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();
});
@nexispl

This comment has been minimized.

Copy link

@nexispl nexispl commented May 3, 2019

nice!

@PinalVaghasiya

This comment has been minimized.

Copy link

@PinalVaghasiya PinalVaghasiya commented Jun 17, 2019

Great!

@besstilahun

This comment has been minimized.

Copy link

@besstilahun besstilahun commented Feb 12, 2020

awesome!

@diego1campos

This comment has been minimized.

Copy link

@diego1campos diego1campos commented Feb 28, 2020

Gorgeously great!!

@hollywoodpig

This comment has been minimized.

Copy link

@hollywoodpig hollywoodpig commented Mar 21, 2020

thank you a lot

@marcelleblass

This comment has been minimized.

Copy link

@marcelleblass marcelleblass commented Oct 28, 2020

Just great, exactly what I needed!

@mvictor10

This comment has been minimized.

Copy link

@mvictor10 mvictor10 commented Apr 17, 2021

boa

@mvictor10

This comment has been minimized.

Copy link

@mvictor10 mvictor10 commented Apr 17, 2021

Me ajudou muito a resolver o problema que eu estava tendo com o modal.

Help me much....one fixed the problem that was had with modal. Thanks Very much.

@caub

This comment has been minimized.

Copy link

@caub caub commented May 2, 2021

history.replaceState('', document.title, location.pathname+location.search);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment