My thought is that search results could be rendered faster using an SPA-style setup as the rest of the page wouldn't have to be reloaded, yet Google Search still uses server side rendering on their results in 2020.
Is there any particular technical reason they are doing this?
My thoughts on possible reasons are:
* they want to support browsers that have JavaScript disabled and/or older browsers / TOR
* legacy reasons -- their whole infrastructure is designed to deliver results via server side rendering and it would be a pain to change it
* they are in general afraid to make sweeping changes to google search (don't fix what isn't broken)
* some interesting technical advantage of server side rendering in this scenario over client side rendering that I am unaware of but would be curious to learn about
- Send a small amount of HTML and CSS for the browser to show on the page; or
- Send a JavaScript application framework and JSON results, then have the browser interpret the JavaScript, parse the JSON, generate the HTML and show on the page
With an approach like Svelte takes, you can make the second option pretty workable, but you'll still never beat sending markup directly if your goal is to render a small amount of static content as quickly as possible.
Also, from technical point of view there is no point in generating JSON output (or any other format), and use that format by a JavaScript based processor to generate HTML, when you can directly generate HTML that will be as simple as the JSON. There are not many savings. Why?
3 results of a simplified query engine output in HTML: [DIV class="results"]
[DIV class="result"] [DIV class="url"]URL[/DIV] [DIV class="description"]description[/DIV] [/DIV]
[DIV class="result"] [DIV class="url"]URL[/DIV] [DIV class="description"]description[/DIV] [/DIV]
[DIV class="result"] [DIV class="url"]URL[/DIV] [DIV class="description"]description[/DIV] [/DIV]
These results are usable as is, the browser will render them and does not need anything else to do it.3 results of a simplified query engine output in JSON:
"results": [
{
"url": "URL",
"description": "DESCRIPTION"
},
{
"url": "URL",
"description": "DESCRIPTION"
},
{
"url": "URL",
"description": "DESCRIPTION"
}
]
This output does not save much space. It is equally as complex on the server-side.But this output is not usable by the user as will not be displayed in a usable form, so you need JavaScript code to process it and generate HTML that will be usable.
So why generate the same list of things two times? It is better, easier and more accessible for the user if you generate HTML the first time.
Just my opinion. This might not be the real reason.
Why on Earth are are Google results pages non-responsive?