0

How can I remove internal link from the URL in my browser so when user refresh website he can see default URL?

For example:

URL: www.something.com //default website url

after using internal links URL takes this form:

URL: www.something.com/#top

When I click refresh on my browser I am still seeing

URL: www.something.com/#top and I want to see URL: www.something.com

because on my iPad this is triggering two server calls and I need to be sure to remove those internal links.

Amit
  • 15,217
  • 8
  • 46
  • 68
user123_456
  • 5,635
  • 26
  • 84
  • 140
  • Why would you want to do that? The URL, including the hash (`#top`) represents a certain state on your website. If the user chooses to reload the page, they should be returned to that exact same state. – pixelistik May 11 '13 at 10:00

1 Answers1

1

try to reset the hash on load if it was set before, keep in mind that this removes the ability to get to a certain hash by calling it directly.

window.onload = function(){
    window.location.hash = '';
}
worenga
  • 5,776
  • 2
  • 28
  • 50
  • but I can still use internal links? I just can't call it directly in the URL? – user123_456 May 11 '13 at 09:37
  • exactly. maybe there is a smarter way though – worenga May 11 '13 at 09:38
  • it's not working...I have just test it...I keep getting for example `www.something.com/#` I need to get `www.something.com` – user123_456 May 11 '13 at 09:40
  • I would argue that the empty hash is semantically the same as no #. However the answer for that is provided in http://stackoverflow.com/questions/1397329/how-to-remove-the-hash-from-window-location-with-javascript-without-page-refresh – worenga May 11 '13 at 09:48