3

I am using ajax to display my contents. As I display my contents, I want to change the browser url dynamically without reloading the page. How can I proceed?

window.location.hash="Aboutus";

The above code inserts a # sign. I do not want a hash sign in my url since my page can contains a similar id.

pimvdb
155k80 gold badges312 silver badges357 bronze badges
asked Aug 18, 2011 at 11:36

3 Answers 3

6

Use can use pushState(). Here's some information from Mozilla's developer site:

https://developer.mozilla.org/en/DOM/Manipulating_the_browser_history#The_pushState%28%29.c2.a0method

answered Aug 18, 2011 at 11:38
Sign up to request clarification or add additional context in comments.

Comments

3

You can use History API that is being introduced in HTML5. Here is a link to some examples - you can find links to more resources in the bottom.

Matt
75.4k26 gold badges156 silver badges181 bronze badges
answered Aug 18, 2011 at 11:38

1 Comment

I am getting the Security error" code: "1000..I am using Mozilla 4.0
2

The HTML5 pushState API should answer your problem.

answered Aug 18, 2011 at 11:39

2 Comments

I am getting the Security error" code: "1000..I am using Mozilla 4.0
Try this to check if your browser supports pushState: if (history.pushState) { alert('supported'); }

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.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.