Fix Search-related JavaScript problems

This guide helps you identify and fix JavaScript issues that may be blocking your page, or specific content on JavaScript powered pages, from showing up in Google Search. While Googlebot does run JavaScript, there are some differences and limitations that you need to account for when designing your pages and applications to accommodate how crawlers access and render your content. Our guide on JavaScript SEO basics has more information on how you can optimize your JavaScript site for Google Search.

Googlebot is designed to be a good citizen of the web. Crawling is its main priority, while making sure it doesn't degrade the experience of users visiting the site. Googlebot and its Web Rendering Service (WRS) component continuously analyze and identify resources that don't contribute to essential page content and may not fetch such resources. For example, reporting and error requests that don't contribute to essential page content, and other similar types of requests are unused or unnecessary to extract essential page content. Client-side analytics may not provide a full or accurate representation of Googlebot and WRS activity on your site. Use Search Console to monitor Googlebot and WRS activity and feedback on your site.

If you suspect that JavaScript issues might be blocking your page, or specific content on JavaScript powered pages, from showing up in Google Search, follow these steps. If you're not sure if JavaScript is the main cause, follow our general debugging guide to determine the specific issue.

  1. To test how Google crawls and renders a URL, use the Mobile-Friendly Test or the URL Inspection Tool in Search Console. You can see loaded resources, JavaScript console output and exceptions, rendered DOM, and more information.

    Optionally, we also recommend collecting and auditing JavaScript errors encountered by users, including Googlebot, on your site to identify potential issues that may affect how content is rendered.

  2. Make sure to prevent soft 404 errors. In a single-page application (SPA), this can be especially difficult. To prevent error pages from being indexed, you can use one or both of the following strategies:
    • Redirect to a URL where the server responds with a 404 status code.
    • Add or change the robots meta tag to noindex.
  3. Expect Googlebot to decline user permission requests.
  4. Don't use fragment URLs to load different content.
  5. Don't rely on data persistence to serve content.
  6. Use content fingerprinting to avoid caching issues with Googlebot.
  7. Ensure that your application uses feature detection for all critical APIs that it needs and provide a fallback behavior or polyfill where applicable.
  8. Make sure your content works with HTTP connections.
  9. Make sure your web components render as expected. Use the Mobile-Friendly Test or the URL Inspection Tool to check if the rendered HTML has all content you expect.
  10. After you fix the items in this checklist, test your page with the Mobile-Friendly Test or the URL inspection tool in Search Console again.

    If you fixed the issue, a green check mark appears and no errors display. If you still see errors, post in the JavaScript Sites in Search Working Group.