3

I have had a search and cannot find what I need, the answers all say it is not possible and a security flaw.

However I have found a Google built website which loads content via ajax and changes the address bar and I need to find out how this is done.

Please have a look at:

http://www.thinkwithgoogle.co.uk/quarterly/people/

And see what you think

Friendly Code
  • 1,585
  • 1
  • 25
  • 41
  • 1
    possible duplicate of [How does github change URL without reloading a page?](http://stackoverflow.com/questions/7591087/how-does-github-change-url-without-reloading-a-page) – Quentin Feb 23 '12 at 11:31

1 Answers1

10

The technique you are talking about is commonly (?) known as pjax

There are several parts to get the effect you are describing:

  1. Manipulating the url and/or headers in the request sent to the server - such that the request is different when part of a pjax request
  2. Server-side logic to honour the URL/headers sent with the request, and return a full html page or html snippet as appropriate
  3. Using the push state method to update the URL in the browser

The last part is specifically what you are asking about, but without the rest of the logic it's not going to be too useful.

BenMorel
  • 34,448
  • 50
  • 182
  • 322
AD7six
  • 63,116
  • 12
  • 91
  • 123
  • Shame that link just says [use a jQuery](http://meta.stackexchange.com/a/19492/19068) plugin instead of explaining how it actually works. – Quentin Feb 23 '12 at 11:37
  • 1
    pjax doesn't work for IE browsers < ver 10. I would recommend jquery address if you need < IE 10 support. – PaulM Feb 23 '12 at 11:44