Browser Redirect

Direct traffic intelligently. This script checks the user's browser type and instantly forwards them to a specific URL if a match is found.

Click to simulate checking for Chrome:

Redirecting to chrome-users.html...

Copy the Script

<script>
var userAgent = navigator.userAgent.toLowerCase();

// Check for Internet Explorer
if (userAgent.indexOf("msie") > -1 || userAgent.indexOf("trident") > -1) {
    window.location.href = "legacy-browser.html";
} 
// Check for Chrome
else if (userAgent.indexOf("chrome") > -1) {
    // window.location.href = "chrome-special.html";
}
</script>

Frequently Asked Questions

Search engines (bots) generally do not execute JavaScript redirects immediately, but they might follow them. Using server-side redirects (PHP/Apache) is generally better for SEO, but this works for client-side logic.

Yes. You can detect 'iPhone' or 'Android' in the user agent and set `window.location.href = 'mobile.html'`.

It executes as soon as the JavaScript loads. Placing it in the `` ensures the redirect happens before the rest of the page renders.