+ Reply to Thread
Results 1 to 2 of 2

Thread: Iphone redirect

  1. #1
    pg.security is offline x10Hosting Member pg.security is an unknown quantity at this point
    Join Date
    Nov 2009
    Posts
    30

    Iphone redirect

    <script type="text/javascript" src="js/webkit_version_xl.js"></script>
    ...
    {literal}
    <script language="JavaScript" type="text/javascript">
    <!--
    var version = get_webkit_version();
    var iPhone_regex = /iPhone|iPod/;
    var result = version['browser'].search(iPhone_regex);
    if (result != -1) {
    window.location = "iphoneoptimized.htm";
    }
    // -->
    </script>
    {/literal}

    are there anythings to make work faster or somethin

  2. #2
    lemon-tree's Avatar
    lemon-tree is offline x10 Minion lemon-tree has a spectacular aura about
    Join Date
    Nov 2007
    Posts
    1,420

    Re: Iphone redirect

    If you did it in PHP it would certainly be quicker. Try this at the top of your page, the 'header' function must be called before anything else is sent. I haven't tested this though.

    PHP Code:
    <?php
    $ua 
    $_SERVER['HTTP_USER_AGENT'];
    $regex '/iPhone|iPod/';
    if(
    preg_match($regex$ua){
    header('Location: http://www.example.com/');
    }
    ?>

+ Reply to Thread

Similar Threads

  1. Best Apple iPhone Gadgets 2009
    By neteater in forum Computers & Technology
    Replies: 4
    Last Post: 10-05-2009, 11:54 PM
  2. Flickr for iPhone!
    By beechy in forum Computers & Technology
    Replies: 0
    Last Post: 10-09-2008, 12:40 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers