Ryan Zygg
Ryan Zygg

Reputation: 341

How does Facebook work with AJAX?

How does Facebook work with AJAX? Thanks a lot!

Before

http://www.facebook.com/#/events.php

Now

http://www.facebook.com/?sk=events

Upvotes: 4

Views: 655

Answers (1)

Nick Craver
Nick Craver

Reputation: 630409

It's still doing the hash URLs and AJAX requests under the covers (though it fails fairly gracefully as well), it's just using some HTML5 features with history to push a different URL to your address bar.

If you view the site in an older browser that doesn't support this yet (everything besides Chrome at the moment) you'll still see the #!/path format (for Google indexing) on the URL, for example:

http://www.facebook.com/home.php?#!/?sk=events

Specifically it's using history.pushState() and history.replaceState() added in HTML5, if the browser supports it to display another (direct) URL in your address bar.

Upvotes: 9

Related Questions