How not to show #anchor in the URL?

How can I prevent #anchor from going to the URL? I am using pure JavaScript throughout my project.

I would like to see the clear URLs as: "www.exemple.com/"
I don’t want it like this: "www.exemple.com/#anchor"

<a href="#anchor">

<div id="#anchor">

38 thoughts on “How not to show #anchor in the URL?”

Leave a Comment