Skip to main content
All CollectionsSite AuditIssues
"JavaScript broken" error in Site Audit
"JavaScript broken" error in Site Audit

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

Anna avatar
Written by Anna
Updated over 2 years ago

What triggers this issue?

This issue reports JavaScript files that return one of the 4xx or 5xx status codes.

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

Why is it important?

Broken JS files that take part in content rendering on your pages can significantly damage the user experience.

The page layout can be broken. Besides, if the broken JS file is supposed to generate some content, it will be visible to neither people nor search engines.

How to fix it?

Such JavaScript files could have been deleted, moved or renamed. Also, the external website hosting the JS file can be unavailable.

Replace, fix or remove links to the broken JS files on your pages.

To get the list of pages that reference the broken internal or external JS file, click on the number in "No. of JS inlinks" column in this report.

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.

Where practically possible, keep the JavaScript files within your website.

Did this answer your question?