0

Does anyone know how to check in php if a browser has webgl or not and display a true or false value? I know if I use:

$_SERVER['HTTP_USER_AGENT'] . "\n\n";

$browser = get_browser(null, true);
print_r($browser);

http://php.net/manual/en/function.get-browser.php

displays all the attributes/features of a browser, but does it do webgl? Please advise.

Thanks

Rizzo
  • 283
  • 1
  • 5
  • 13

1 Answers1

2

You can use javascript to check it for you, then you can make it send the value to php.

JavaScript:

if (Modernizr.webgl) { 
  var webgl = "True";
  window.location.href = "myphpfile.php?webgl =" + webgl ;
} else { 
  var webgl = "False";
  window.location.href = "myphpfile.php?webgl =" + webgl ;
}

PHP:

$value = $_GET['name'];
ALeifsson
  • 70
  • 7
  • Any way to do it without adding modernizr library? I wanted to keep it as slim as possible? – Rizzo Feb 01 '15 at 17:16