Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 955625
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T00:24:39+00:00 2026-05-16T00:24:39+00:00

Quick question. I am writing a website and would like to redirect users to

  • 0

Quick question. I am writing a website and would like to redirect users to different webpages depending on their browser and also their version of the iPhone operating software. I know you may come back at me and say it should be up to the user to decide which site they view, they don’t have a choice in this matter.

The code I am using is in javascript and can identify between the different browsers but not the iPhone operating systems which is the key to this. This is the code:


if(navigator.userAgent.match(/iPhone/i)) {
    if(navigator.userAgent.match(Version/4)){
        if(document.cookie.indexOf("iphone_redirect=false") == -1) window.location ="iPhone4.html";
    }
    if(document.cookie.indexOf("iphone_redirect=false") == -1) window.location ="iPhone.html";
}
//Rest of the site goes here

Not sure if the brackets are right here it’s early and may have got that wrong but any help will be appreciated.

Sam

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T00:24:40+00:00Added an answer on May 16, 2026 at 12:24 am

    This should work:

    if(navigator.userAgent.match(/iPhone/i)) {
        if(navigator.userAgent.match(/iPhone OS 4/i)) {
            if(document.cookie.indexOf("iphone_redirect=false") == -1) {
                window.location ="iPhone4.html";
            }
        }
        else {
            if(document.cookie.indexOf("iphone_redirect=false") == -1) {
                window.location ="iPhone.html";
             }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just have a quick question... any help would be greatly appreciate! I'm writing a
Quick question about Wordpress PHP: I am writing a theme and I want to
I'm writing a simple program to convert text to strings. One quick question, how
a quick, simple question from me about for-loops. Situation I'm currently writing some high-performance
This is just a quick Question. I am writing a feature here that creates
Quick, and perhaps silly question, but here it is nevertheless. Writing to a register
I am writing a Grails app and I have a quick question about the
I'm writing a quick website in ASP (classic) Javascript. I'm using a prepared statement
Quick question. I was writing out some code and was curious if there is
Just a quick question about the above subject. Basically, I'm writing a piece of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.