Jump to content

Determine Browser


Ell20

Recommended Posts

Hi,

 

Is there anyway in which you can determine which version of browser, more specifically if the user has Internet Explorer Version 6 or lower?

 

If they do, is it possible to ask them to upgrade before they can view the site?

 

Really appreciate any help on this

 

Elliot

Link to comment
Share on other sites

I use this code for web browser checking:

<?php

// Web Browser Check

//        _______
// ----- | CONF. |
//     
// add new browsers in lower case here, separated
// by spaces -  order is important: from left to
// right browser family becomes more precise
$browsers = "mozilla msie gecko firefox ";
$browsers.= "konqueror safari netscape navigator ";
$browsers.= "opera mosaic lynx amaya omniweb";

//        _______
// ----- |PROCESS|
//   
$browsers = split(" ", $browsers);

$nua = strToLower( $_SERVER['HTTP_USER_AGENT']);

$l = strlen($nua);
for ($i=0; $i<count($browsers); $i++){
  $browser = $browsers[$i];
  $n = stristr($nua, $browser);
  if(strlen($n)>0){
    $GLOBALS["ver"] = "";
    $GLOBALS["nav"] = $browser;
    $j=strpos($nua, $GLOBALS["nav"])+$n+strlen($GLOBALS["nav"])+1;
    for (; $j<=$l; $j++){
      $s = substr ($nua, $j, 1);
      if(is_numeric($GLOBALS["ver"].$s) )
      $GLOBALS["ver"] .= $s;
      else
      break;
    }
  }
}

//        _______
// ----- |  USE  |
//      
//echo("<pre>Your browser is: ");
//echo($GLOBALS["nav"] . " " . $GLOBALS["ver"] . "</pre>");

?>

 

Regards ACE

Link to comment
Share on other sites

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.