Jump to content

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]);

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.