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
Use can use pushState(). Here's some information from Mozilla's developer site:
answered Aug 18, 2011 at 11:38
Sign up to request clarification or add additional context in comments.
Comments
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
Manish Basdeo
I am getting the Security error" code: "1000..I am using Mozilla 4.0
The HTML5 pushState API should answer your problem.
answered Aug 18, 2011 at 11:39
2 Comments
Manish Basdeo
I am getting the Security error" code: "1000..I am using Mozilla 4.0
red
Try this to check if your browser supports pushState: if (history.pushState) { alert('supported'); }
lang-js