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 12 of 12
  1. #1
    Senior Coder o0O0o.o0O0o's Avatar
    Join Date
    Jan 2008
    Location
    C:\Windows\System32
    Posts
    1,018
    Thanks
    19
    Thanked 9 Times in 9 Posts

    redirect site to mobile website on phones

    HI is there any way to check that if someone types the website name and if its from mobile then mobile site will open othwise if computer then main site opens up
    Please de-reputate me
    © 0o0o0o0

    Its better to rule in Hell then to serve in Heaven

  • #2
    Master Coder
    Join Date
    Apr 2003
    Location
    in my house
    Posts
    5,211
    Thanks
    39
    Thanked 201 Times in 197 Posts
    I haven't worked with mobiles yet but I understand, if you provide a stylesheet for handheld, you can make your site layout as you went for mobiles/pda's.

    That said, I haven't heard the expression 'pda' much recently so, maybe, I am out of date.

    bazz
    "The day you stop learning is the day you become obsolete"! - my late Dad.

    Why do some people say "I don't know for sure"? If they don't know for sure then, they don't know!
    Useful MySQL resource
    Useful MySQL link

  • #3
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    Quote Originally Posted by bazz View Post
    That said, I haven't heard the expression 'pda' much recently so, maybe, I am out of date.

    bazz
    Hehe... you and me both!

    I think they're calling them smart phones these days. Worthless gadgets that just complicate our lives unnecessarily. Grumble grumble, grumble some more. Young kids and their vapid lives, grumble grumble.

    0o0o0o, the terms is "media type", and it's as simple as using the attribute "media" in each different css file you include in your webpage. I found this really good article using something called Google:

    http://www.howtocreate.co.uk/tutorials/css/mediatypes

    I'm not sure why you'd want an entirely different page for each media type... sounds like a lot of needless extra work to me. But if you really want to do that, you can use Javascript or PHP to determine the browser and redirect based on which browser is being used.

  • #4
    Master Coder
    Join Date
    Apr 2003
    Location
    in my house
    Posts
    5,211
    Thanks
    39
    Thanked 201 Times in 197 Posts
    lol fumigator

    best way I think is to have a 'generic' css file set to "media type='all' " and then a specific one for print, screen,handheld etc

    bazz
    "The day you stop learning is the day you become obsolete"! - my late Dad.

    Why do some people say "I don't know for sure"? If they don't know for sure then, they don't know!
    Useful MySQL resource
    Useful MySQL link

  • #5
    The Apostate Apostropartheid's Avatar
    Join Date
    Oct 2007
    Posts
    3,215
    Thanks
    16
    Thanked 265 Times in 263 Posts
    You'd think that'd work, wouldn't you? But some devices--including the iPhone--ignore the handheld media type and use screen instead.

  • #6
    Master Coder
    Join Date
    Apr 2003
    Location
    in my house
    Posts
    5,211
    Thanks
    39
    Thanked 201 Times in 197 Posts
    blimey, have we now got another standards compliance issue?

    bazz
    "The day you stop learning is the day you become obsolete"! - my late Dad.

    Why do some people say "I don't know for sure"? If they don't know for sure then, they don't know!
    Useful MySQL resource
    Useful MySQL link

  • #7
    Senior Coder
    Join Date
    Oct 2005
    Posts
    1,340
    Thanks
    0
    Thanked 61 Times in 60 Posts
    The iPhone's browser is Safari and is the full blown browser capable of handling/displaying anything, iirc.

  • #8
    The Apostate Apostropartheid's Avatar
    Join Date
    Oct 2007
    Posts
    3,215
    Thanks
    16
    Thanked 265 Times in 263 Posts
    I think it must be slightly scaled down or forked from the main WebKit engine, because CF on my iPhone is very slightly different from on my laptop.

  • #9
    Senior Coder o0O0o.o0O0o's Avatar
    Join Date
    Jan 2008
    Location
    C:\Windows\System32
    Posts
    1,018
    Thanks
    19
    Thanked 9 Times in 9 Posts
    If i want to have different site for iphone will that work if i use media type in safari?
    Please de-reputate me
    © 0o0o0o0

    Its better to rule in Hell then to serve in Heaven

  • #10
    Regular Coder Zangeel's Avatar
    Join Date
    Oct 2007
    Location
    public_html/
    Posts
    638
    Thanks
    17
    Thanked 79 Times in 79 Posts
    PHP Code:
    $aString is_string((string)array()) ? true false// true :D 
    [/CENTER]

  • #11
    New Coder
    Join Date
    Sep 2009
    Location
    uk
    Posts
    81
    Thanks
    4
    Thanked 3 Times in 3 Posts

    Smile try this

    try this my sites wap and web this redirects a browser to either a wap folder or a web folder but u can name them what u need too .
    Code:
    <?php
    global $userBrowser;
    // Your wapsite
    $wmllink = "wap/index.php";
    // Your website
    $htmllink = "web/index.php";
    //Detect the browser
    $userBrowser = $_SERVER['HTTP_USER_AGENT']; 
    //echo $userBrowser;
    if(strpos(strtoupper($HTTP_ACCEPT),"VND.WAP.XHTML+XML") > 0)
    {
    $ub="PC";
    }
    else if(strpos(strtoupper($HTTP_ACCEPT),"XHTML+XML") > 0)
    {
    $ub="PC";
    }
    //Check for Mozilla
    else if(stristr($userBrowser, 'Mozilla')) 
    {
    $ub="PC";
    }
    //Check for msie
    else if(stristr($userBrowser, 'msie')) 
    {
    $ub="PC";
    }
    //Check for IE
    else if(stristr($userBrowser, 'internet explorer')) 
    {
    $ub="PC";
    }
    //Check for opera
    else if(stristr($userBrowser, 'opera')) 
    {
    $ub="pc";
    }
    //Check for Opera
    else if(stristr($userBrowser, 'Opera')) 
    {
    $ub="pc";
    }
    else
    {
     $ub="WML";
      }
    if($ub == "PC") {
      header("Location: ".$htmllink);
      exit;
     }
     else 
    {
      header("Location: ".$wmllink);
      exit;
        }	
    ini_set("include_path",ini_get("include_path").":../:../../:../../../:../../../../");
    include_once("768c5.php");
    ?>
    enjoy

  • #12
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,621
    Thanks
    6
    Thanked 1,001 Times in 974 Posts
    Quote Originally Posted by Apostropartheid View Post
    You'd think that'd work, wouldn't you? But some devices--including the iPhone--ignore the handheld media type and use screen instead.
    There are ways to serve different styles, though, through … uhm, I don’t remember what it was called … ah, here we go: media queries. The iPhone ignores the “handheld” media type but reacts on these media queries so effectively you can tell the devices that support those: “if the screen size is this and that display these styles”.

    A List Apart has always the good articles, and not less this time:

  • Users who have thanked VIPStephan for this post:

    funnymoney (09-15-2009)


  •  

    Posting Permissions

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