通过UserAgent来识别客户端浏览器的版本和类型
测试代码:
<!DOCTYPE html>
<html><head><meta charset="UTF-8" /><title>Welcome to nginx!</title></head><body><h2>php $_SERVER['HTTP_USER_AGENT']</h2><p><?phpecho $_SERVER['HTTP_USER_AGENT'];?></p><h2>js navigator.userAgent</h2><p><script>document.write(navigator.userAgent);</script><p><!--[if lte IE 6]><p>lte ie6</p><![endif]--><!--[if lte IE 7]><p>lte ie7</p><![endif]--><!--[if lte IE 8]><p>lte ie8</p><![endif]--><!--[if lte IE 9]><p>lte ie9</p><![endif]--></body></html>