Changing the URL without reloading the page
I would like to know if it's possible to change the contents of the URL in the browser without reloading the page?
I use jQuery and Ajax to load new parts of my page. When I choose "product one", the direct link would be mysite.com/product1
and for "product two" would be mysite.com/product2
, but I don't want to reload the site to these pages.
Solution 1:
its now possible with HTML_5..
chack this link... http://www.spoiledmilk.dk/blog/?p=1922
also facebook and google using this tric beside Hash(#) attribute
Solution 2:
You will have to add hash #
if you want to prevent page from reloading.
The css-tricks.com has an excellent screencast on that, have a look at:
Best Practices with Dynamic Content
Solution 3:
just use this one
window.history.pushState("object or string", "Title", "/new-url");
Solution 4:
This is possible in HTML5. See a demo here.
You can change the URL to another URL within the same domain, but can not change the domain for security reasons.
See the history
interface in HTML5 specification for details.