Google 的抓取工具会解释 Javascript 吗?如果我通过 AJAX 加载页面怎么办? [英] Do Google's crawlers interpret Javascript? What if I load a page through AJAX?

查看:23
本文介绍了Google 的抓取工具会解释 Javascript 吗?如果我通过 AJAX 加载页面怎么办?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当用户进入我的页面时,我必须进行另一个 AJAX 调用...以在 div 中加载数据.我的应用程序就是这样工作的.

When a user enters my page, I have to make another AJAX call...to load data inside a div. That's just how my application works.

问题是...当我查看此代码的源代码时,它不包含该 AJAX 的源代码.当然,当我执行 wget URL 时……它也不显示 AJAX HTML.有道理.

The problem is...when I view the source of this code, it does not contain the source of that AJAX. Of course, when I do wget URL ...it also does not show the AJAX HTML. Makes sense.

但是谷歌呢?Google 能否像浏览器一样抓取内容?我如何允许 Google 像用户看到的那样抓取我的网页?

But what about Google? Will Google be able to crawl the content, as if it's a browser? How do I allow Google to crawl my page just like a user would see it?

推荐答案

更新: 从答案到 这个关于Ajax 生成的内容、抓取和黑名单"的问题 我找到了这个关于 Google 抓取 AJAX 请求的方式,这是关于 使 AJAX 应用程序可抓取.

Updated: From the answer to this question about "Ajax generated content, crawling and black listing" I found this document about the way Google crawls AJAX requests which is part of a collection of documents about Making AJAX Applications Crawlable.

简而言之,这意味着您需要使用 <a href="#!data">...</a> 而不是 <a href="#data">...</a> 然后为 URL path/to/path?_escaped_fragment_=data 提供真实的服务器端答案.

In short, it means you need to use <a href="#!data">...</a> rather than <a href="#data">...</a> and then supply a real server-side answer to the URL path/to/path?_escaped_fragment_=data.

还要考虑 <link/> 标签为爬虫提供对 SEO 友好内容的提示.,其中 这篇文章解释了一下,是个不错的人选

Also consider a <link/> tag to supply crawlers with a hint to SEO-friendly content. <link rel="canonical"/>, which this article explains a bit, is a good candidate

注意:我的答案来自:https://stackoverflow.com/questions/10006825/search-engine-misunderstanting/10006925#comment12792862_10006925 因为我好像不能在这里删除我的.

Note: I took the answer from: https://stackoverflow.com/questions/10006825/search-engine-misunderstanting/10006925#comment12792862_10006925 because it seems I can't delete mine here.

这篇关于Google 的抓取工具会解释 Javascript 吗?如果我通过 AJAX 加载页面怎么办?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆