There was a question of such a plan:

There is a site "site.ru" necessary for AJAX'u load the page with users, which is located at "site.ru/users/". I loaded it, but another question arises: how to make the url of the browser also change the url to "site.ru/users/", I just want to transfer the entire site to AJAX, but I think users will not like it , for example, they will not be able to give their friends a link to themselves or another page. Here are sites like vk.com and odkl.ru they also upload content to AJAX, otherwise it would be impossible to listen to music and move through the pages, and I want to notice that their URL changes. I ask the guru to help me.

  • And what kind of discrimination, what my comment was deleted, what the hell is that? - markuper
  • Link was just to answer, why was it removed? - markuper
  • Please write again, maybe here, some kind of machine? Spam Protection - Sexy Girl

2 answers 2

To change the address in the browser without rebooting, you can use the History API , namely pushState . Of course, this will only work in browsers that support HTML5 .

The simplest example is:

 var redirect = '/users/'; history.pushState('', '', redirect); 

For more, follow the link and get acquainted with the details.

  • Thank you very much, and still not tell me how to deal with such terrible browsers as IE? just like that and keep links to <a href="/users/" onclick="ajaxContent('/users/');"> Users </a> or am I wrong? - Sexy Girl
  • New IEs work well with them, and they will be more expensive for old ones. IMHO. - xEdelweiss
  • Well, what about office workers? Who have to use what they installed? They're sitting on XP and can't get away with IE7, since there are no rights ... - Sexy Girl
  • right there in Dagonka and SEO you need to keep the same links as something ... - Sexy Girl
  • If your site focuses on them, you can suffer. In principle, your option with links has the right to live. But I didn’t have to work closely with this topic - neither with SEO, nor with old browsers, so I can’t tell you anything. Yes, and it pulls on another question. a , b , c , d - xEdelweiss pm

I am currently studying the same topic and this jquery Address docs plugin.

  • I wrote my own function, and now the site works for me completely, like on AJAX and also for those who have java scripts turned off - Sexy Girl