Browser diagnostics · Practical guide
HTTP redirects vs JavaScript and meta refresh
A browser can change pages without receiving an HTTP redirect. JavaScript, HTML refresh, stored browser state and server responses can produce similar visible results. Inspect the first document response and the action that starts the next navigation before deciding which rule to change.
Recognize navigation after a successful response
Suppose /old-install serves the HTML below with status 200, and /guides/install is an existing page on the same site. The browser loads the first document and its script requests another page. There is no 301 or 302 in that first response.
RedirectPath stops at this 200 response because it follows HTTP redirects using GET. It does not execute JavaScript, follow HTML meta refresh or process Refresh headers as browser navigation. A completed HTTP trace therefore does not describe every action a browser takes afterward.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Installation guide moved</title>
<script>window.location.replace('/guides/install');</script>
</head>
<body>
<p><a href="/guides/install">Read the installation guide</a></p>
</body>
</html> - In a staging copy, inspect the response headers for /old-install and confirm its actual status.
- Open DevTools before navigating, enable Preserve log and inspect both document requests.
- Find the script that starts the second navigation, then compare that evidence with the HTTP scan.
Reference: MDN: Redirections in HTTP
Identify what starts the next navigation
An HTTP redirect sends a redirect status and Location before the destination is loaded. JavaScript and refresh operate through the browser after it receives a document. The HTTP Refresh header belongs to the latter category even though its instruction arrives in a response header.
location.assign() normally leaves the current page in session history; location.replace() replaces that history entry. This changes Back-button behavior, not the HTTP status of the original response. Neither method is a way to send a 301 from JavaScript.
| Mechanism | Evidence to inspect | Example |
|---|---|---|
| HTTP redirect | A redirect status and Location response header | 301 with Location: /guides/install |
| JavaScript navigation | Script source and the next request initiator | window.location.replace("/guides/install") |
| HTML meta refresh | A refresh element in the document head | <meta http-equiv="refresh" content="0; url=/guides/install"> |
| HTTP Refresh | Refresh response header, potentially on a 200 | Refresh: 0; url=/guides/install |
Reference: MDN: The Refresh header and HTML loading
Capture the first response and its initiator
In Chrome DevTools, open Network, enable Preserve log and Disable cache, then navigate from the exact starting URL. Filter for documents. Inspect the first entry: status, Location, Refresh and whether the response came from cache. Inspect the next document and its Initiator; when JavaScript is responsible, a stack trace may identify the script.
Check the original response HTML for refresh markup and navigation code. Also inspect loaded scripts if the instruction is external. Do not rely only on Elements: it shows the current DOM, which scripts may have changed after the response arrived.
The commands below inspect the first GET response and then follow HTTP redirects. Replace the example URL with your own. If both stop at 200 while the browser continues, examine the browser evidence; this difference alone does not prove that JavaScript is the cause.
curl -q -sS --max-time 30 -D - -o /dev/null 'https://example.com/old-install'
curl -q -sS -L --max-redirs 10 --max-time 30 -D - -o /dev/null \
-w '\nFinal HTTP URL: %{url_effective}\n' \
'https://example.com/old-install' Reference: Chrome DevTools: Network recording and initiators
Account for cookies, cached redirects and HSTS
RedirectPath sends no cookies, including cookies set by an earlier hop. A signed-in browser may receive a different server response, and a client script may use local storage to choose a destination. Compare a fresh signed-out profile with the affected session. A fresh profile can still have built-in HSTS preload rules.
HSTS can upgrade an HTTP URL before an insecure request reaches the server. If DevTools labels an internal upgrade, do not treat it as evidence that your origin returned that status. Check the actual HTTP endpoint independently; browser HTTPS-only settings can also affect the journey.
A stored redirect may retain yesterday's destination. Disabling cache helps isolate that case, but does not clear HSTS or cookies. If a difference remains, compare the precise path and query, user agent, time and deployment region. Inspect service-worker handling if the site uses one. Keep each observed response separate from your hypothesis about its cause.
Reference: MDN: How HSTS upgrades requests
Put a permanent page move in the response
When you control the server or CDN, implement a lasting document move as a 301 or 308 with Location. Choose 308 if preserving the method and body is required. This standalone PHP example handles the old GET page before any output; in a framework, use its redirect response or the existing routing layer. Do not install competing rules at several layers.
If the host only lets you edit HTML, an immediate meta refresh in the head, with a visible link to the destination, is a fallback. Google interprets zero-second refresh as permanent and delayed refresh as temporary. JavaScript is another fallback, but Google may miss it if rendering fails. Test the user journey as well as the search intent.
After changing the rule, repeat the original GET and browser checks, inspect the destination content and test Back-button behavior. Confirm that the old script or refresh no longer creates a second, conflicting navigation. Update links you control to the destination.
<?php
header('Location: /guides/install', true, 301);
exit; Reference: Google Search Central: HTTP, refresh and JavaScript redirects
Keep reading
Related guides
301 vs 302 vs 307 vs 308 redirects
Choose a redirect status with a practical decision table, then verify GET, POST, caching and the final destination.
Read guide TroubleshootingHow to find and fix redirect chains and loops
Read redirect traces, identify conflicting www or trailing-slash rules, and repair chains without losing the page, path or required query parameters.
Read guide HTTPS migrationsAn HTTP to HTTPS redirect checklist
Redirect HTTP to HTTPS without losing paths or query parameters. Check Nginx rules, www certificates, mixed content and HSTS readiness.
Read guide Proxies and CDNsHow to fix redirect loops behind a proxy or CDN
Diagnose repeated HTTPS redirects behind TLS termination, check Cloudflare origin encryption, and configure trusted forwarded schemes without trusting arbitrary clients.
Read guide Domain migrationsHow to check redirects during a domain migration
Map old URLs to useful new destinations, preserve important parameters and verify TLS, redirects, page content and Google Search signals.
Read guideHTTP status code reference for redirects and endpoints
Compare 301, 302, 303, 307 and 308, then interpret common endpoint errors and redirect stop reasons.
Open reference