Programming: Detecting a wireless device?

Discussion in 'OT Technology' started by MacandCheese, Oct 12, 2005.

  1. MacandCheese

    MacandCheese Mmm Mmmm Goood ;)

    Joined:
    Oct 9, 2002
    Messages:
    208
    Likes Received:
    0
    Location:
    USA
    Hi everyone!

    I've searched around a bit and could not come up with much. Hoping you'll be able to steer me in the right direction. :cool:

    Lets say i have a website, normal sized website (for example, 800x600 or larger). Lots of tables, images, etc... Is there any type of coding out there that will detect if a wireless device is browsing your site and redirect them automatically to a different address on yoru site with the right resolution? Maybe a piece of code that detects resolution and redirects that way?

    I'm hoping to find (preferably) php or js coding as my site is pretty much all php/mysql driven.

    Hope that's clear enough... thanks for any and all information!! :)
     
  2. SLED

    SLED build an idiot proof device and someone else will

    Joined:
    Sep 20, 2001
    Messages:
    28,118
    Likes Received:
    0
    Location:
    AZ, like a bauce!
    what server technology are you developing your site with?
     
  3. 5Gen_Prelude

    5Gen_Prelude There might not be an "I" in the word "Team", but

    Joined:
    Mar 14, 2000
    Messages:
    14,519
    Likes Received:
    1
    Location:
    Vancouver, BC, CANADA
    Couldn't you check the browser being used?
     
  4. MacandCheese

    MacandCheese Mmm Mmmm Goood ;)

    Joined:
    Oct 9, 2002
    Messages:
    208
    Likes Received:
    0
    Location:
    USA
    Sled, Not sure if i understand the question... but it's a unix platform with mainly php coding.

    5gen, Good idea and i could go that route... But that may take a bit more work than simply working with resolutions. If i went the browser route, i would have to account for every browser for pc's/macs/etc and all th ehandhelds (BB's, palm, windows, etc). With a resolution, i could say anything with: "less than a 640x480, go to small.php else goto big.php" and that woudl cover just about everything i need.

    All suggestions are welcome! :)
     
  5. SLED

    SLED build an idiot proof device and someone else will

    Joined:
    Sep 20, 2001
    Messages:
    28,118
    Likes Received:
    0
    Location:
    AZ, like a bauce!
  6. MacandCheese

    MacandCheese Mmm Mmmm Goood ;)

    Joined:
    Oct 9, 2002
    Messages:
    208
    Likes Received:
    0
    Location:
    USA
    ^ good find!!

    I like this demo:

    Code:
    <?php
    // WURFL demo by "Andrea Trasatti" <atrasatti AT users DOT sourceforge DOT net>
    
    require_once('./wurfl_config.php'); // include the configuration, make sure to configure it properly
    require_once(WURFL_CLASS_FILE); // include the main class. This is defined in the configuration file
    
    // creating the WURFL object
    $myDevice = new wurfl_class($wurfl, $wurfl_agents);
    $myDevice->GetDeviceCapabilitiesFromAgent($_SERVER["HTTP_USER_AGENT"]);
    if ( $myDevice->browser_is_wap ) {
      header("Content-Type: text/vnd.wap.wml");
      echo '<?xml version="1.0" encoding="ISO-8859-1"?>'."\n";
    ?>
    <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org//DTD//wml_1.1.xml">
    <wml>
     <card>
      <p mode="nowrap">
    
    <?php
      if ( $myDevice->getDeviceCapability('gif') ) {
        echo '<img src="logo.gif" alt="Global TEL" />'."\n";
      } else {
        echo '<img src="logo.wbmp" alt="Global TEL" />'."\n<br/>\n";
      }
    ?>
    
    <a href="index.php">Home</a><br/>
     </p>
     </card>
    </wml>
    
    <?php
    } else {
    ?>
    <img src="logo.gif"><br><br>
    Welcome Web browser.<br>
    We are sorry, but we are only offering WAP services, at this time.<br>
    <?php } ?>
    I think i can manipulate it to do what i want to do. I will have to mess with it when i get home.

    Thanks for the help! Any other suggestions are welcomed! The more ideas, the better :cool:
     

Share This Page