A
A
Alexey Maksimov2016-01-04 13:16:16
Domain name market
Alexey Maksimov, 2016-01-04 13:16:16

How to use a URL like VKontakte?

On VKontakte, all URLs look like this:
vk.com/feed
vk.com/im
And when you switch between them, the page does not reload completely, but only the necessary part. I only know that such a result can be achieved only if you use one page and generate content on it with scripts, but in this case the URL will look like site.ru?page=news, which is not very beautiful. So how is it still used on VKontakte?

Answer the question

In order to leave comments, you need to log in

5 answer(s)
A
Alexey Ukolov, 2016-01-04
@alexey-m-ukolov

Small example .
Description of the API .

A
Anton Babilya, 2016-01-04
@lordonx3

They make friends with js, and render the page.
5651fd07f1.jpg

S
Space, 2016-01-04
@ruslite

You can always change the look of the url. You can also remove the extension (php, for example) or add it the other way around, no matter how you load the page.

N
nick1m, 2016-01-04
@nick1m

"And when you switch between them, the page does not reload completely, but only the necessary part."
When switching between vk.com/feed and vk.com/im, it will be mandatory to reload, unless the browser does not reload the cache, i.e. if the url has changed in the navigation bar, but if only the anchor (#) has changed, then this is a completely different matter.
You can pull data to the right place using Ajax, for example, by attaching functions to certain links, actions, buttons.

A
Access Denied, 2016-01-04
@AccessDenied80

https://github.com/defunkt/jquery-pjax

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question