“Often, I see JavaScript being blamed when the problem is something else,” Martin Splitt, search developer advocate at Google, cited as the underlying issue behind many of the site errors he comes across. Splitt discussed the most common JavaScript-related issues that can hurt a site’s SEO as well as some ways to avoid them.
One popular misconception is that JavaScript simply does not work well for search engines. “Well, you could [have JavaScript work well for search engines] if your JavaScript wouldn’t be roboted, so we [Google] can’t access your JavaScript,” Splitt said. When using external JavaScript files as part of the page, some SEOs and site owners use their robots.txt file to block Google from accessing that code, unaware of the consequence. This does not break functionality for users, but will disable search engines from fetching that JavaScript to render the page.