Change URL without reloading the page

I would like to know if it is possible to change the contents of a URL in a browser without reloading the page?

I use jQuery and Ajax to load new parts of my page. When I select "product one", the direct link will be mysite.com/product1 , and for "product two" it will be mysite.com/product2 , but I do not want to reload the site on these pages.

+17
javascript jquery html
Aug 01 '10 at 8:22
source share
7 answers

You need to add the hash # if you want to prevent the page from reloading.

Css-tricks.com has a great screencast, look at:

Dynamic Content Best Practices

+12
Aug 01 '10 at 8:25
source share

now possible with HTML_5 ..

chack this link ... http://www.spoiledmilk.dk/blog/?p=1922

also facebook and google using this trick next to the hash attribute (#)

+15
Apr 03 2018-11-11T00:
source share

This is possible in HTML5. See Demo here .

You can change the URL to another URL in the same domain, but you cannot change the domain for security reasons.

For more information, see the history interface in the HTML5 specification .

+7
Jul 01 '12 at 6:05
source share

just use this

 window.history.pushState("object or string", "Title", "/new-url"); 
+7
Dec 18 '12 at 5:13
source share

You can do this. Although, probably, you will need a modern browser. Take a look at this page: http://www.20thingsilearned.com/ created by the Google Chrome team (I used Chrome 9 to read it). Changing pages does not reload the entire web page, but changes the URL.

+1
Nov 20 '10 at 13:12
source share

Yes, you can use the HTML5 History API. Check this page and this example.

+1
Jul 25 2018-12-12T00:
source share

You can not. Only if you change the hash, as sAc told you.

But I can ask, WHY?

-3
Aug 01 '10 at 8:27
source share



All Articles