How to remove all targets in url in Js

If I want to show a specific part of the page when used #id

in a url.

so for example my url:

www.example.com/#geometry

When I reload my page, I want all targets ( #geometry

) on the url to be removed before reloading. Thus, it will only be www.example.com

.

How can i do this?

Update: I dont know my url will be generated from server side, see this my url

       localhost:8080/home?requestParams=%7B%22tabMode%22 

      

and now to view any part of this page I add

       #id 

      

so it becomes

     localhost:8080/home?requestParams=%7B%22tabMode%22#geometry

      

now on reloading this page i want to delete this #geometry, how can i do that?

+3


source to share


1 answer


location.hash = '';



At the beginning of your script.

0


source







All Articles