Can googlebot do basic javascript?

Suppose I have something like this page:

<noscript>You need JS for this page</noscript> <script> document.write('you have javascript'); $(function() { /* Some DOM heavy coding */ }); <script> 

How will it look on Google? If someone searches google for “do you have javascript”, will they see my page?

+1
source share
3 answers

The safest answer: don't rely on it. In particular, because you are doing heavy DOM encoding.

If the code should be in Google for search purposes, then create this piece of HTML on the server and use JavaScript only for interaction. Google crawlers are getting smarter, but I do not expect them to understand arbitrary JavaScript code.

+4
source
+4
source

For my part, I can confirm that GoogleBot is running JavaScript, and according to the IP address, it really is, not just UA spoofing from the browser.

I found out about it today when I wanted to generate some statistics about the use of AdBlockPlus and the like, when I saw how GoogleBot appeared in magazines, which I did not expect. It appears that it also uses JavaScript to display some new URLs for crawling; I mean, if JavaScript loads the page in IFRAME with some parameters in the URL, it may first try to load the page without parameters, and then later try to load the page with parameters. This may suggest that you first run JavaScript in the form of a sandbox to see what it does.

+1
source

Source: https://habr.com/ru/post/951423/


All Articles