Search code examples
phpdefault-browser

What is Default Browser in PHP get_browser?


I see search results in SO of get_browser resulting Default Browser for example Chrome Users, I on the other hand am not sure of what the users are using I think Default Browser results in my case are robots/crawlers/etc.

I'm using the full_php_browscap.ini version and it gets a Default Browser value for the browser. What is Default Browser? And when does get_browser return Default Browser?


Solution

  • I think 'Default Browser' is returned when the user-agent is unknown. Either the agent is missing from browscap or maybe browscap can't be found.

    You can use $_SERVER['HTTP_USER_AGENT'] to find out wich user-agent was used. Maybe this string is just made up (robots indeed).

    Someone replied the folowing on the php manual page for get_browser:

    We are using get_browser() function for useragent Mozilla/4.0 (compatible; MSIE 4.01; Windows NT) the get_browser function is returning as Default Browser and Platform = unknown.

    So i added this to my browscap.ini manually:

    [Mozilla/4.0 (compatible; MSIE 4.01; Windows NT)] Parent=IE 4.01 Platform=WinNT

    I Hope this helps.