css - Is there a way to load an alternate stylesheet using PHP? -
i'm building mobile version of site, , @ point, creating alternate stylesheet suffice make site adept mobile devices. want use user agent detection php script detect platform, , switch stylesheets accordingly. there way that?
you might want try out librabry check if mobile device can try out library: http://code.google.com/p/php-mobile-detect/ (this supports detecting specific oses)
and have code like
if($detect->isios()){ echo <link rel="stylesheet" type="text/css" href="iosstyle.css" />; } else if ($detect->ismobile()) { echo <link rel="stylesheet" type="text/css" href="mobile.css" />; } else{ echo <link rel="stylesheet" type="text/css" href="normal.css" />; }
fyi, these libraries dependent on user-agent value in header , other headers too.
Comments
Post a Comment