Should I use pushState to update my URLs instead of #! to manage Ajax navigation?



Should I use pushState to update my URLs instead of using the hashbang (#!) style to manage Ajax navigation?
Paul Irish, Mountain View, CA

Have a question? Ask it in our Webmaster Help Forum: http://groups.google.com/a/googleproductforums.com/forum/#!forum/webmasters

Want your question to be answered on a video like this? Follow us on Twitter and look for an announcement when we take new questions: http://twitter.com/googlewmc

More videos: http://www.youtube.com/GoogleWebmasterHelp
Webmaster Central Blog: http://googlewebmastercentral.blogspot.com/
Webmaster Central: http://www.google.com/webmasters/

source

19 thoughts on “Should I use pushState to update my URLs instead of #! to manage Ajax navigation?”

  1. of course pushState is the modern, new way of updating the URL without a page refresh. Although, big players like Grooveshark and even Gmail, still use the hashbang approach. Why? Simple. Backwards compatibility. IE only starts supporting pushState at version 10

  2. Hi Matt, How can I make my website redirect to multiple Ip specific to country for PHP based website, as Google.com redirects to Google.co.in for India. Which is the best way for Google bot to catch up and make it understand?

  3. sniffing for googlebot is always bad news
    the "_escaped_fragment_" for pushState should just be the URL.
    pushState is just a way to change the address bar. The new address should actually exist on the server.
    / -> pushState -> /mypage
    if /mypage doesn't actually exist then people going to it directly get a 404.
    I don't think google does anything special for pushState. It just follows the hyperlink like normal.

  4. you need to recreate the whole state server side for #! too
    #! means you can replace it with ?_escaped_fragment_= (or &_escaped_fragment_=) and have the server return the content, or something like that.

    Also, these questions should submitted to one of those links in the video description if you want Matt to see them. I don't know if he reads these comments for questions.

    I don't know anything about if google can run javascript.

  5. Check out Rob Ousbey's (of Distilled) example site if you want to know more about pushState (and popState for back button). Should be the first result searching for [pushState html5 example]. No affiliation, just a fan.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top