Does Google's crawler index asynchronously loaded elements?

自古美人都是妖i 提交于 2019-12-23 13:39:46

问题


I've built some widget for websites which is asynchronously loaded after the page is loaded:

<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>

Is there anyway to notify Google's crawler to index the page only after the page is fully loaded (after the async JavaScript modified the HTML)?


回答1:


No. You have to set up static mirror pages for asynchronous content. See here: http://code.google.com/web/ajaxcrawling/docs/getting-started.html




回答2:


Things have evolved since then:

  • Google crawls and indexes all content that was injected by javascript.
  • Google even shows results in the SERP that are based on asynchronously injected content.
  • Google can handle content from httpRequest().

(...)

  • Dynamically updated meta elements get crawled and indexed, too.

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



来源:https://stackoverflow.com/questions/7640004/does-googles-crawler-index-asynchronously-loaded-elements

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!