Forum Moderators: open

Message Too Old, No Replies

Hide Jump Links in address bar

         

mr205

2:53 pm on Apr 20, 2017 (gmt 0)

5+ Year Member



I have set a jump link using the wordpress menu to jump to a section on the page. I do not want #jump-link showing up in the address bar and I have not had much help finding a solution that works. Any help would be appreciated if this topic has been discussed please just provide me the link.

NickMNS

3:12 pm on Apr 20, 2017 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Do you simply want to delete the #jump-link portion of the URL after the link has been pressed, or do you want to make it such that when the user press the back button they will return to the previous page and not the previous section on the same page?

mr205

5:39 pm on Apr 20, 2017 (gmt 0)

5+ Year Member



I just do not want the #jump-link to show up in the address bar. We have a "to top" arrow its only a one page site but when they push "about" it scrolls to about but it also put the #about-jump-link in the address bar which is what we want to hide or remove from the address window.

NickMNS

5:52 pm on Apr 20, 2017 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Why? What would be the benefit of doing this? It seems like a lot of complication for purely aesthetic reasons.

NickMNS

6:04 pm on Apr 20, 2017 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You can use the pushState() method but it will impact the functioning of the back button (in a desirable way).
[developer.mozilla.org...]

lucy24

5:14 am on Apr 21, 2017 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I don't suppose it's any use pointing out that the people reading this forum may be the only people on the planet who still know what an address bar is. What proportion of your visitors are using browsers whose address bar even shows the full URL instead of just the hostname?

As a user, I'm a bit leery of code that asks my browser to lie to me--which is essentially what you're trying to do. “I'm really at Point A, but I'm going to tell my human user that I'm at Point B.” (Suppressing a "top" fragment is a special case, because you can just ask the browser to pretend it is arriving at the page from scratch, and there's your top-of-page.)