dcsimg
www.webdeveloper.com
Results 1 to 2 of 2

Thread: iPhone user agent detection

  1. #1
    Join Date
    Dec 2009
    Posts
    22

    Exclamation iPhone user agent detection

    First off iv developed a web based iphone game im putting on the appstore for money so of course it wouldnt be fair if users played on the computer free without paying.

    Ok what i need to do is to have a page that detects the iPhone browser and loads the page. lol thats the easy part the hard part is if the browser is ANYTHING other than the iPhone browser the page will redirect to another page. I know this is possible because iv seen it done i just cant figure out how. I found this code but it only blocks certain browsers and the player of my game could just change their user agent and play for free

    CODE:

    <script language="JavaScript"
    type="text/JavaScript">
    if(navigator.appName == "Microsoft Internet Explorer")
    {
    window.location = "ragespace.html"
    }
    if(navigator.appName == "Netscape")
    {
    window.location = "ragespace.html"
    }
    </script>

  2. #2
    Join Date
    Dec 2005
    Posts
    2,984
    http://iphone.wikidot.com/detection

    google is such a simple, yet powerful, tool to use.

    EDIT: I should probably take the time to clarify that useragent detection is not the ideal since it can be changed by the user. The below link appears to be a very good alternative:
    http://webkit.org/blog/119/webkit-de...nd-ipod-touch/
    Last edited by aj_nsc; 12-21-2009 at 07:05 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles