atlookup

Issue Library JavaScript SEO

JavaScript SEO High severity

How to fix JavaScript-set redirects

JS-only redirect (window.location). Use server-side 301 instead.

Estimated impact

Ranking signal
80%
Crawl efficiency
70%
User experience
70%

Where you'll see this

Detected in

URL Inspection > 'View tested page' rendered HTML atlookup JS-render audit DevTools 'Disable JavaScript' test

Typical signals

Rendered HTML missing main content Pages indexed but ranking for nothing Soft-404 spike

What it looks like (and what it should look like)

Reference snippets for this category. The bad example shows the pattern that triggers the issue; the good example shows the fix in place.

Crawler-hostile JS

// ❌ Content rendered ONLY client-side
function App() {
  const [posts, setPosts] = useState(null);
  useEffect(() => fetch('/api/posts').then(r => r.json()).then(setPosts), []);
  if (!posts) return <Spinner />;        // crawler sees just spinner HTML
  return <Articles data={posts} />;
}

// ❌ Link rendered as <span> with onClick
<span onClick={() => navigate('/about')}>About</span>

Why this matters

JavaScript-set redirects isn't just a checklist item — when present, it directly affects how search engines and AI assistants understand and rank the page. Sites that consistently resolve high-severity issue outrank competitors who treat it as an afterthought.

Practically, this issue surfaces in three places:

  • Crawlers and indexers may skip, throttle, or misinterpret affected URLs.
  • Ranking algorithms weight related signals when deciding position.
  • AI assistants use these signals as a citation-quality filter when picking sources.

How to detect it on your site

The fastest way to confirm whether javascript-set redirects is present:

  1. Run a free atlookup audit — surfaces this and dozens of other issues automatically across all pages, with each finding traced to a measurable signal.
  2. Cross-reference with Google Search Console for any related coverage warnings.
  3. For per-page deep dives, run Lighthouse on representative URLs.
Run a free audit on your site

60-second page-by-page report. Every issue from this library, scored and prioritized.

Start free audit

Common causes

  • Configuration drift — a setting that was once correct silently broke during a deploy, theme update, or plugin install.
  • Template-level bug — every page sharing the template inherits the issue. Fix the template once, fix every affected page.
  • Third-party interference — a CDN, plugin, or external service introduces the problem after every cache flush.
  • Migration leftover — old configuration or stale internal links from a prior site move never fully cleaned up.

Step-by-step fix

Apply these in order. Most are 5-30 minutes each and resolve the most common cause first.

1

Confirm the scope

Run a full crawl. Note exactly how many URLs are affected and which templates they belong to. Fix the template, not the symptoms.

2

Inspect the cause

Compare an affected page's source to a healthy page's. The diff almost always points directly at the cause.

3

Apply the template-level fix

Mirror the "Good" snippet above. Make the change in the source/template, not on individual pages.

4

Clear caches

Page cache, CDN cache, browser cache. Most "the fix didn't work" reports are actually "the fix is cached behind a stale layer."

5

Re-crawl and verify

Run another audit. Confirm the affected URL count drops to zero (or close). If it doesn't, you're seeing a different cause — go back to Step 2.

Verification checklist

  • Re-crawl shows zero affected URLs (was > 0)
  • Search Console coverage report clears any related warnings within 30 days
  • Spot-check two representative URLs in browser DevTools / View Source
  • Confirm fix survives the next deploy (no plugin/theme reverts it)
  • Document the fix in your codebase or runbook for future reference

Preventing it from coming back

  • Add a CI/CD audit step that crawls staging before every deploy.
  • Monitor weekly via automated re-crawls so issues surface in days, not quarters.
  • Document the fix in the template/config so the next dev doesn't undo it during routine work.

Frequently Asked Questions

How long does it take to fix javascript-set redirects?

Most fixes for javascript-set redirects take 30 minutes to 2 hours when the cause is template-level. Sites with multiple cascading causes can take half a day. Re-crawl verification adds another hour.

Will fixing this affect my rankings?

If javascript-set redirects is hurting crawlability, indexability, or Core Web Vitals — yes, often within 2-6 weeks. Lower-impact issues see slower, smaller gains, but they compound when fixed alongside other issues.

Can I fix javascript-set redirects without a developer?

Some fixes work via the CMS admin. Template-level or server-config fixes typically need developer access. Identify the exact cause first; the right fix path follows.

How do I know javascript-set redirects is fully resolved?

Three signals: re-crawl shows zero affected URLs, Search Console clears any related warnings within 30 days, and any related performance metrics improve in CrUX field data.

Can javascript-set redirects cause a manual penalty?

Rarely on its own. Persistent issues combined with other quality signals can contribute to algorithmic suppression. Fix as soon as you spot it.