Home ajax Changing the URL in the browser address bar

Changing the URL in the browser address bar




The question arose such:

There is a site “Site.ru” you need to download a page with users, which is located at Site.ru/users/. To load, I loaded, only the other question comes: how to make the URL in the address bar also changed the URL on “site.ru/users/”, just want the entire site to translate to AJAX, but I think that users do not like that they For example, they will not be able to give their friends a link to themselves well, or a different other page. Here are sites like vk.com and Odkl.ru They are also on Ajax is loading content, otherwise it would be impossible to listen to music and move through the pages, and I want to note that they change the URL. I ask the guru to help me.

Answer 1, Authority 100%

To reboot Change Address in the browser You can use History API , namely Pushstate . Of course, it will work only in browsers that support HTML5 .

Simplest example:

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

For the big go Link And Meet the details.

Answer 2, Authority 25%

I am now studying the same topic and this plugin jQuery Address Docs .

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions