Jump to content

browser detect and redirect


azukah

Recommended Posts

would anyone know how to not only detect the browser but redirect to a different page?... once redirected to a different page, show the browser and its version and based on that, offer a link to upgrade to the newest version of that browser???

 

if the users have the latest version of whatever browser they are using, then no problem, they can go to the index BUT if users have earlier versions , they they are redirected to a page that offers them to upgrade to the latest of what they are using...???

 

Also, if mobile user, then will just use a different CSS

Link to comment
https://forums.phpfreaks.com/topic/208599-browser-detect-and-redirect/
Share on other sites

$_SERVER['HTTP_USER_AGENT'] will have browser info from the header request. You will need to parse the info out, though get_browser may be useful for you for that.  Make some conditions using if or switch and redirect with header (don't forget to exit after the header call to stop the rest of the script from executing).

Check browser and then redirect.

 

$text = $_SERVER['HTTP_USER_AGENT'];
$var[0] = 'Nokia';
$var[1] = 'Mozilla/3.0';
-
-
-
-
$var[200] = 'HTC';

$result = count($var);

for ($i=0;$i<$result;$i++) // Something like this
$refactor = stristr($text, $var[$i]);

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.