...

View Full Version : redirect site to mobile website on phones



o0O0o.o0O0o
09-04-2009, 02:44 AM
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

bazz
09-04-2009, 03:23 AM
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. :eek:

bazz

Fumigator
09-04-2009, 05:49 PM
That said, I haven't heard the expression 'pda' much recently so, maybe, I am out of date. :eek:

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.

bazz
09-04-2009, 06:25 PM
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

Apostropartheid
09-04-2009, 07:57 PM
You'd think that'd work, wouldn't you? But some devices--including the iPhone--ignore the handheld media type and use screen instead.

bazz
09-04-2009, 08:01 PM
blimey, have we now got another standards compliance issue? :rolleyes:

bazz

drhowarddrfine
09-04-2009, 08:42 PM
The iPhone's browser is Safari and is the full blown browser capable of handling/displaying anything, iirc.

Apostropartheid
09-04-2009, 11:22 PM
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.

o0O0o.o0O0o
09-07-2009, 12:54 AM
If i want to have different site for iphone will that work if i use media type in safari?

Zangeel
09-07-2009, 03:50 AM
Javascript has this capability: http://www.hand-interactive.com/resources/detect-mobile-javascript.htm

nclemale
09-08-2009, 10:45 PM
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 .


<?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

VIPStephan
09-09-2009, 12:20 AM
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 (http://www.w3.org/TR/css3-mediaqueries/). 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:

Put Your Content In My Pocket (http://www.alistapart.com/articles/putyourcontentinmypocket/)
Put Your Content In My Pocket, Part II (http://www.alistapart.com/articles/putyourcontentinmypocketpart2/)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum