How to submit HTML snapshots of an AJAX application using a browser without a browser, from PHP?

You are having real problems with how to launch a mute browser to serve static HTML snapshots of a site that uses javascript (sammy.js, to be specific) to deliver AJAX content.

I am working on setting up Google so that the AJAX application crawls:

http://code.google.com/web/ajaxcrawling/docs/getting-started.html

which for the most part is great and very clear, and I have no problem finding _escaped_fragment_ urls.

Most of the templates are executed on the server side, so I was tempted to just write a PHP snapshot file that uses the same regular expression matches from the sammy application code (there are many routes) to include in various template files. However, many actions occur in a javascript application, so that would mean mirroring all this processing in PHP, which means supporting both files side by side, cross-language is a lot of work!

Now I read that you can use a mute browser to “render” the page and execute all javascript (matching #! / Route and delivering the correct content for the request), and then returning all the DOM content as HTML, which will be used for googlebot.

I searched for a long time and hard and can not find any step-by-step guide on maintaining headless browsers with PHP (for general newbs Java). I suppose that means that I just don't know what to look for.

What interests me is: even more work on setting up and using a mute browser to serve these HTML snapshots? And if so, is it worth it at all?

Also, if there are any guides you could point me to, that would be great!

Thank!

Joss

+3
source share
2 answers

I think you are better off copying on the server what you have on the client side. Although this may seem like an ineffective exercise, it at least has a clear and limited scope.

. , , , QA , , .

Selenium-RC, , , . Selenium-RC, , , , , , .

( Java, HTMLUnit, , , , Selenium-RC. , - .)

, PHP...

, , HTML, : , , GoogleBot , . ? , , ? - .

+2

- - , node.js, github ...

0

All Articles