The principle of prerender is What?
There are still some doubts. The original file loaded from the homepage “/”is almost empty, so the crawler can’t see anything. Using phantomjs to generate files for the crawler is a bit confusing. Such as “/”next request get news, can such content crawler see it? Or is it that when the crawler comes to find “/”,it returns the content to him after the server responds to it, which is similar to rewriting a website?
To put it simply,
When the server receives a request, for example:
http://www.suibianba.com/news, your Single-page application returns an almost empty HTML to the client, which is then checked by the browser
/newsPart of them do front-end routing to dynamically fill in data to
Then if the request is from a crawler, it is obviously inappropriate to return empty, so we have it
prerenderThe service, which has received enough requests, runs this HTML directly in a js engine inside on the server (just as the browser does), and broadcasts an event notification after the content is dynamically filled in.
phantomjs“The content is ready and can be returned to the crawler,” so the crawler can get a complete HTML, just like what was rendered in the browser inside.