Google如何隐藏搜索结果的HTML源代码? [英] How does Google hide HTML source of search results?
问题描述
当您尝试查看Google 搜索结果页面的源代码时,您只会看到一堆javascript代码而不是可读文本。 Google如何做到这一点?
我已经通过网络搜索,但找不到一个很好的解释,只有我找到的是这样的: http://goo.gl/FIvD6 ,这并没有什么帮助。
I我不是一个Web开发人员,但我只是好奇。简单的解释会很好。感谢。
Google用您记下的JavaScript构建DOM。它出于以下原因:
- 减少服务器上的负载以生成带有HTML标记的每个动态结果集。 >
- Google以JSON供稿(示例)返回结果 - pastebin。生成JSON响应所需的处理能力比完整的HTML片段或全新页面所需的处理能力要低。
- 速度。假设用户有一个体面的互联网连接,与服务器端相比,客户端渲染页面的速度可以忽略不计。
如上所示,跳入萤幕并浏览:)
When you try to view the source code of a Google search results page you just see a bunch of javascript code instead of readable text. How does Google do that?
I have searched through the web but couldn't find a good explanation, only thing I found was this: http://goo.gl/FIvD6 and it is not really helpful.
I am not a web developer but I just got curious. A brief explanation would be nice. Thanks.
Google builds the DOM with the javascript you noted. It does this for a number of reasons:
- Decrease the load on the server to generate each dynamic result set with HTML markup.
- Google returns the results in a JSON feed (example) - pastebin. Less processing power is required to produce the JSON response than a full HTML snippet or completely new page
- Speed. Assuming that the user has a decent internet connection, the speed of the pages rendering on the client side compared to the server side is negligible.
As suggested above, jump into firebug and have a look around :)
这篇关于Google如何隐藏搜索结果的HTML源代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!