How to determine if Firefox browser is with php?

Possible duplicate:
Any php code to detect browser with version and operating system?
How to detect Internet Explorer and firefox using PHP?

I need to add specific html for browsers without firefox, so I need to first determine if the user is using firefox or not, I have to do this with php. Something along this line?

<!--[if Firefox]> Mozilla only HTML here! <![endif]--> 

Is anyone Thanks

+4
source share
6 answers

Use this code snippet to get a browser view:

 if (isset($_SERVER['HTTP_USER_AGENT'])) { $agent = $_SERVER['HTTP_USER_AGENT']; } 

Then compare with the user agent string.

For example, to detect "Firefox", you could do:

 if (strlen(strstr($agent, 'Firefox')) > 0) { $browser = 'firefox'; } 
+15
source

php get_browser built-in function is your answer. or try using $ _SERVER ['HTTP_USER_AGENT'] or just use this script http://chrisschuld.com/projects/browser-php-detecting-a-users-browser-from-php/

+2
source
+1
source

You can use the User-Agent header in the request. Either you perform a regular expression check to find specific Firefox templates, or you can use a library such as WURFL, which is more likely to identify the browser.

See this answer for an example on how to do this.

+1
source

Use $ _SERVER ['HTTP_USER_AGENT'] to get a custom browser.

+1
source

view $_SERVER['HTTP_USER_AGENT']

e.g. Mozilla/5.0 (Windows NT 5.1; rv:13.0a1) Gecko/20120206 Firefox/13.0a1

0
source

Source: https://habr.com/ru/post/1395578/


All Articles