【问题标题】:Does Google's crawler index asynchronously loaded elements?谷歌的爬虫索引异步加载的元素吗?
【发布时间】:2011-10-03 19:58:16
【问题描述】:

我为网站构建了一些在页面加载后异步加载的小部件:

<html>
    <head>...</head>
    <body>
        <div>...</div>

        <script type="text/javascript">
            (function(){
                var ns = document.createElement("script");
                ns.type = "text/javascript"; 
                ns.async = true;
                ns.src = "http://mydomain.com/myjavascript.js";
                var s = document.getElementsByTagName("script")[0];
                s.parentNode.insertBefore(ns, s);
            })();
        </script>
    </body>
</html>

只有在页面完全加载后(异步 JavaScript 修改 HTML 之后)才通知 Google 的爬虫索引该页面?

【问题讨论】:

  • 不知道你的问题的答案,你的页面应该有完整的内容并且即使没有脚本也可以浏览。
  • 不,这不是重复 - 这是不同的场景。

标签: javascript asynchronous web-crawler google-crawlers


【解决方案1】:

没有。您必须为异步内容设置静态镜像页面。看这里: http://code.google.com/web/ajaxcrawling/docs/getting-started.html

【讨论】:

    【解决方案2】:

    从那以后事情发生了变化:

    • Google 会抓取所有由 javascript 注入的内容并将其编入索引。
    • Google 甚至在基于异步的 SERP 中显示结果 注入内容。
    • Google 可以处理来自 httpRequest() 的内容。

    (...)

    • 动态更新元 元素也会被抓取和编入索引。

    来源:http://www.centrical.com/test/google-json-ld-and-javascript-crawling-and-indexing-test.html

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-02-25
      • 1970-01-01
      • 2016-11-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-10-15
      • 2023-03-09
      相关资源
      最近更新 更多