Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I make my page look good in Google Instant Previews?

When you view a page from my site in Google Instant Previews, you see an AJAX error message (caused by some AJAX that fires on document ready):

alt text

I assume the way to fix this is to make my javascript compatible with whatever javascript engine Google's "browser" uses (like one might design for IE6).

So: what javascript does Google Instant Previews understand?

like image 599
Tom Lehman Avatar asked Nov 11 '10 06:11

Tom Lehman


3 Answers

Previews are generated in one of two ways:

  • Via normal Googlebot crawls
  • On the fly using the user-agent Mozilla/5.0 (en-us) AppleWebKit/525.13 (KHTML, like Gecko; Google Web Preview) Version/3.1 Safari/525.13

If the content has been crawled recently, it's likely to reuse the normal crawled content. If not, then it'll try to generate it on the fly. Internally, it uses a similar Safari/Webkit-based browser, so that's what you'd probably want to use to check your pages. I believe there's a way to modify the user-agent that Safari uses, which would be one way to do a more specific check.

If for some reason the AJAX content can't be fetched (say it's disallowed by robots.txt or the server actively blocks Googlebot from accessing it), then the site should fail gracefully (as it should when users run into the same problem). Don't show an error popup -- just log it internally and fall back to some default content.

One way to double-check if it works after you have made changes to your site's template is to do a site:-query to find similar, obscure pages, and to check their preview images; if nobody else has checked the preview images, it will be rendered on the fly so you will see the results right away. Once you're happy with how it renders, it will take a bit of time to catch up and re-render the existing pages; it doesn't update with the same frequency as cached pages or normal snippets do.

like image 98
John Mueller Avatar answered Oct 11 '22 05:10

John Mueller


Here is Google's description of the preview tool for users. Here is there Developer FAQs.

like image 33
fncomp Avatar answered Oct 11 '22 05:10

fncomp


It seems odd that your page tells the visitor that there was a JavaScript error in the first place. As a web user, I would be annoyed to get a pop-up because the AJAX failed. My suggestion would be to remove that pop-up and have your AJAX retry if there was an error.

like image 27
Tim Christensen Avatar answered Oct 11 '22 04:10

Tim Christensen