Hi i have written some ajax code where user stays in page www.somedomain.com, inserts some data and ajax brings a response. When response comes, i want url to be changed to www.somedomain.com/response but browser still stays to www.somedomain.com page content. So page will not change but only the url will be slightly different. Also i do not want index.html to be visible in url.
-
3You'll need to use the [HTML5 History API](http://diveintohtml5.info/history.html). – Christian Nov 12 '12 at 14:06
-
for hiding 'index.html' you can read this http://stackoverflow.com/questions/1288678/hide-index-php-or-index-html-of-an-url – Pieter Willaert Nov 12 '12 at 14:08
-
1possible duplicate of [How AJAX is done in github source browse?](http://stackoverflow.com/questions/9041872/how-ajax-is-done-in-github-source-browse) – Quentin Nov 12 '12 at 14:43
-
Yes but "history" doesn't cooperate with ie right? – Marios Fakiolas Nov 12 '12 at 19:07
2 Answers
To support older browsers you can use hash navigation:
Keeping history of hash/anchor changes in JavaScript
If you only want it to run on modern browsers you can use the HTML 5 History API.
http://diveintohtml5.info/history.html (Link thanks to Christian Varg)
Obviously you can use HTML5 History API to change the browser URL but in your case you have to change the url on Ajax response so u have to handle Ajax events at client side. i.e If you van to change the URL when Ajax response start and change back to original when the Ajax responce end you have to handle two events of Ajax.
- OnRequestStart
- OnResponseEnd
The first method call at same time your Ajax request start and the second one called when your ajax request become in complete state.
So in this handler method you can change the UL of browser....

- 819
- 2
- 11
- 31