-->

Does Google's crawler index asynchronously loa

2019-06-26 04:03发布

问题:

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