In short
Ahrefs flags "JavaScript redirects" for JavaScript file URLs that return a 3xx redirect before the actual file. The script still loads, but later, which can delay interactive features and page rendering. Common causes are HTTP-to-HTTPS changes, domain changes, and third-party scripts that moved. Update the script references to the final URL.
This issue is about script files whose URL redirects, not about redirects done with JavaScript.
How to fix it
Check where each flagged script redirects to.
Replace the old URL with the final one in your templates, plugin settings or tag manager.
For third-party scripts, copy the current embed code from the provider's dashboard.
WordPress: scripts are usually added by plugins or themes; updating them often updates the URL. For hand-added scripts, edit the header or footer code.
Shopify, Webflow and Wix: check custom code and app embeds for old script URLs.
Custom builds: reference your own scripts with relative paths so domain or protocol changes never create redirects.
Not to be confused with
A redirect performed by JavaScript (window.location = ...) is a different thing. Google can follow those, but server-side 301 redirects are preferred.
This guide isn't affiliated with or endorsed by Ahrefs.
Related issues
Sources and references
Google Search Central, Redirects and Google Search
web.dev, Avoid multiple page redirects

About the author
Nazmul Nikhil
Head of SEO & Assistant Manager, Digital Marketing at Notionhive
SEO and AI search consultant in Dhaka, Bangladesh, helping small and mid-size businesses in the USA, UK, Australia and Canada.



