Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 10 of 10
  1. #1
    Regular Coder
    Join Date
    May 2008
    Location
    Michigan
    Posts
    216
    Thanks
    10
    Thanked 1 Time in 1 Post

    Mobile browser detection and redirection

    I'm trying to expand my website's compatibility to mobile devices. My website is www.inthedesigns.net, and I would like it to detect mobile browsers and redirect to http://m.inthedesigns.net.

    I know javascript is out of the question since the majority of mobile devices either don't support it or it's turned off by default.

    Is there a simple way of doing this, like through PHP or my .htaccess file?

    Much thanks!

  • #2
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by nicky View Post
    I'm trying to expand my website's compatibility to mobile devices. My website is www.inthedesigns.net, and I would like it to detect mobile browsers and redirect to http://m.inthedesigns.net.

    I know javascript is out of the question since the majority of mobile devices either don't support it or it's turned off by default.

    Is there a simple way of doing this, like through PHP or my .htaccess file?

    Much thanks!
    http://httpd.apache.org/docs/2.2/rew...endent-content

    Edit: I just find this:
    http://detectmobilebrowsers.mobi/

    best regards
    Last edited by oesxyl; 10-15-2009 at 04:00 AM.

  • #3
    Regular Coder
    Join Date
    May 2008
    Location
    Michigan
    Posts
    216
    Thanks
    10
    Thanked 1 Time in 1 Post
    I couldn't implement the PHP coding in my header.php file. It kept saying there was an error.

  • #4
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    What error?

    There is also the media attribute you can use on the link tag when you bring in stylesheets so you can have a different one for mobile browsers. However obeying that is up to the browser, I believe the iPhone browser uses the screen media type and not the mobile one (as an example).
    OracleGuy

  • #5
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by nicky View Post
    I couldn't implement the PHP coding in my header.php file. It kept saying there was an error.
    Quote Originally Posted by oracleguy View Post
    What error?

    There is also the media attribute you can use on the link tag when you bring in stylesheets so you can have a different one for mobile browsers. However obeying that is up to the browser, I believe the iPhone browser uses the screen media type and not the mobile one (as an example).
    a guess:

    Warning: Cannot modify header information - headers already sent by (output started at...
    if this is the case, you can't echo or print anything before the header line.

    best regards

  • #6
    New to the CF scene
    Join Date
    May 2008
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    @nicky,

    There are a few web services set up already which do this. we use handsetdetection.com

    In some cases, rather than just detecting whether the person browsing is mobile or not, we customise our clients sites to be optimised to the screen size of the actual device.

  • #7
    New Coder
    Join Date
    Jan 2009
    Posts
    26
    Thanks
    3
    Thanked 0 Times in 0 Posts
    I use this as index.php and redirect it according to the device.

    Code:
    <?php
    $mobile = $_SERVER['HTTP_USER_AGENT'];
    $bberry = "BlackBerry";
    $blackberry = 'http://blackberry.yoursite.com/';
    $main = "default.php";
    if ((strpos($_SERVER['HTTP_USER_AGENT'], 'BlackBerry')) !== false)
    {
    header("location: $blackberry");
    }
    else
    {
    header("location: $main");
    }
    ?>
    This is the code I use in a PHP script that works perfectly for me.
    Last edited by ghost2012; 07-02-2010 at 02:11 PM.

  • #8
    New to the CF scene
    Join Date
    Dec 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You could also use a rewrite rule in .htaccess that would be something similar such as:

    Code:
    RewriteCond %{HTTP_USER_AGENT} (OneMobileUserAgent|AnotherMobileUserAgent|...)
    RewriteRule (.*) $1?mobile=1 [L]
    Just need to paste your mobileuseragent list in the condition and voila.


    ______________________
    Assurance auto

  • #9
    New to the CF scene
    Join Date
    Dec 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Ozeki Message server

    Do any of you know how to receive messages using SMS gateway or Ozeki Message server?

    I am able to send SMS but not receive.

  • #10
    New to the CF scene
    Join Date
    Dec 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by zinedinezidane View Post
    Do any of you know how to receive messages using SMS gateway or Ozeki Message server?

    I am able to send SMS but not receive.
    Ya i am having the same problem can enny one help



    ______________________
    Naruto Shippuden


  •  

    Posting Permissions

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