0

How can I pass from this type of url:

http://domain.com

To this type:

http://domain.com/#0123456789

Without reloading the page.

I do not want to use the HTML5 window.history.replaceState function, as it does not work with the older versions of Internet Explorer.

royhowie
11.2k14 gold badges54 silver badges67 bronze badges
asked Nov 13, 2014 at 0:34
2
  • 2
    the hash link is easy and would work in all browsers. The url replacement is not possible in old browsers. caniuse.com/#search=history I would just fallback on hash links in IE9... Commented Nov 13, 2014 at 0:37
  • http://domain.com/#0123456789 just make this a hyperlink - the page should not be reloaded as it is just a anchor link within the page. Commented Nov 13, 2014 at 0:37

2 Answers 2

1

I found my answer:

location.hash = "0123456789";

Sorry to answer my own question...but no answer gave the right point.

answered Nov 13, 2014 at 0:40
Sign up to request clarification or add additional context in comments.

Comments

0

Like this:

window.location += "/#/123456";
console.log(location.hash);
answered Nov 13, 2014 at 0:43

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.