All Collections
Site Audit
"Page has broken JavaScript" error in Site Audit
"Page has broken JavaScript" error in Site Audit

Learn more about the "Page has broken JavaScript" issue in Ahrefs' Site Audit and how to fix it on your website.

Nick Churick avatar
Written by Nick Churick
Updated over a week ago

What triggers this issue?

This issue reports pages that link to JavaScript file URLs that return one of the 4xx or 5xx HTTP status codes to our crawler. Such image files are widely known as broken images.

The screenshot from Chrome's developer tools, "Network" tab:

Why is it important?

Browsers and search engines won't render Broken JavaScript files. This can negatively affect the user experience on your website. If JavaScript files are supposed to create come content, it won't be indexed by the search engines.

How to fix it?

Check the "Linked JavaScripts" column for the HTTP status code of the file.

Here are the most common HTTP status codes you can come across in this report:
โ€‹The 404 (Not Found) HTTP status code indicates that the file could have been moved or deleted, but the link to it was not changed. To fix this issue, you can restore the JS file with the old URL, edit the link on a page so that it points to a relevant file, or remove the link altogether if that JS file is no longer needed on that page.

The 403 (Forbidden) HTTP status code indicates that our crawler was not allowed to access the JS files. Your server could have started to block requests from our crawler at some point of a crawl. This might happen due to a server or firewall configuration. You can whitelist our IP addresses and run a new crawl.ย 

This can also happen if your JS files are hosted on the external server which blocks our crawler.

The 429 (Too Many Requests) HTTP status codes may indicate that the crawling speed set in the crawl settings for your project is too high for a web server. Reduce it in the crawl settings and run a project re-crawl.

5xx (Server error) HTTP status codes indicate some server issues, and you should address your developer or hosting provider. Your server may be misconfigured, overloaded, or generally slow.

Did this answer your question?