Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 6 of 6
  1. #1
    Junior Member BroLip's Avatar
    Join Date
    Nov 2010
    Location
    Richmond, Virginia
    Posts
    16
    Member #
    25023
    Liked
    1 times
    I have a client that wants me to build a website for smartphones. Does anyone know how to make the site auto detect the smart phone and load the correct site?

  2.  

  3. #2
    Junior Member
    Join Date
    Nov 2010
    Posts
    23
    Member #
    24956
    google "media queries"

  4. #3
    Senior Member Dorky's Avatar
    Join Date
    Jun 2009
    Location
    Destin Florida
    Posts
    1,430
    Member #
    19103
    Liked
    4 times
    PHP Code:
    <?php 
    $browserfind 
    $_SERVER['HTTP_USER_AGENT'];
    $browser_type_array file("browser.txt"FILE_IGNORE_NEW_LINES);
    foreach(
    $browser_type_array as $browser_type)

    $check_browser strpos($browserfind,"$browser_type",0); 
    if (
    $check_browser !== false
    $browser_access "pass"; } }
    if(
    $browser_access !== "pass")
    header("Location: http://yoursite.com/mobile"); } 
    ?>

    Firefox/3
    Firefox/4
    MSIE 8
    MSIE 9
    Chrome/4
    Chrome/5
    Opera/9
    iPhone OS 2_1
    Safari/5
    Google
    facebookexternalhit

    this is in php. you need a file in the same directory as the index called browser.txt in that, list each browser type that is not mobile, one entry per line. make double sure there are no whitespaces after the names on each line. rename the index to index.php then copy the code you see here into the top of the index file. create a folder in that directory called mobile and an index.html in the mobile folder. the secondary index.html is for the mobile version. you will need to add to the browser list because my browser list is for an alt html version.

    while($get_it !== true){ continue; }

  5. #4
    Junior Member BroLip's Avatar
    Join Date
    Nov 2010
    Location
    Richmond, Virginia
    Posts
    16
    Member #
    25023
    Liked
    1 times
    Perfect

    Thanks Dorky, that's exactly what I needed. I'm going to talk to my client today and this will make it look like I know what I'm talking about.

  6. #5
    Senior Member Dorky's Avatar
    Join Date
    Jun 2009
    Location
    Destin Florida
    Posts
    1,430
    Member #
    19103
    Liked
    4 times
    word

    while($get_it !== true){ continue; }

  7. #6
    Junior Member BroLip's Avatar
    Join Date
    Nov 2010
    Location
    Richmond, Virginia
    Posts
    16
    Member #
    25023
    Liked
    1 times
    Another Question

    Dorky, would you happen to know how to make a link so that someone can dial a number automatically from their smart phone?


Remove Ads

Posting Permissions

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

Search tags for this page

auto detect web on smartphone

Click on a term to search for related topics.
All times are GMT -6. The time now is 06:18 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com