How to remove a hash (#) from a hash added when setting an existing hash to an empty line:

location.hash = 'blablabla'; location.hash = ''; 

After the specified code has been executed, the grid (#) remains in the address bar. How to remove it?

  • Describe the example of the actions that you perform. But I still do not quite understand the question - stckvrw
  • The essence is the same as in the listing above: the hash is set, you need to delete it so that nothing remains, including the grid. The option proposed by @VladimirMorulus is appropriate. - Roman Grinyov

1 answer 1

 history.pushState("",document.title,window.location.pathname+window.location.search);