| Substitute a header.php for another header.php based on browser type?
|
Bluestreak

msg:4003129 | 6:39 pm on Oct 7, 2009 (gmt 0) | Hello, I'd like to be able to set up my site with a PHP script that swaps the header.php based on what browser the user has, so if a user is surfing via a mobile Safari browser (iPhone), it will swap the normal header.php with an alternative header.php more suitable for those browsers. Does this make sense? Any help appreciated!
|
physics

msg:4003139 | 6:47 pm on Oct 7, 2009 (gmt 0) | It would probably be better to have all code within the header.php script, and use if/else statements so different code is run depending on the browser (rather than different header.php files). You can get the browser user agent with $_SERVER['HTTP_USER_AGENT'] and then use a regular expression to determine what type of browser it is and serve different code based on if the regular expression matches a browser type of IE, Firefox, etc...
|
Bluestreak

msg:4003146 | 6:55 pm on Oct 7, 2009 (gmt 0) | Hmm, that would save a lot of trouble, the only thing is I only have a rudimentary understanding of PHP so I'd need help on the proper code. The only thing I need to change is to have an if/else statement determine the font size inside a small block. For normal browsers the font size is normal, but for the iPhone it needs to be several sizes smaller (xx-small).
|
|
|