JJohnsenDK Posted January 10, 2008 Share Posted January 10, 2008 Hey How do i get get_browser() to check if the user is using IE or FF? I also tried this: $_SERVER['HTTP_USER_AGENT']; but it gives me this when im using Internet Explorer 7.0: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; WOW64; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.0.04506; Media Center PC 5.0) ??? Quote Link to comment https://forums.phpfreaks.com/topic/85357-get_browser-function-how-does-it-work/ Share on other sites More sharing options...
nikefido Posted January 10, 2008 Share Posted January 10, 2008 On my mac: FireFox: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11 Safari: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en) AppleWebKit/523.12.2 (KHTML, like Gecko) Version/3.0.4 Safari/523.12.2 Opera: Opera/9.20 (Macintosh; Intel Mac OS X; U; en) Looks like all you need to do to determine which is which is something like this: $userString = $_SERVER['HTTP_USER_AGENT']; //and then search the string (strstr() or substr() or something similar) for keywords like "Firefox" "Safari" "Opera" In your case, "MSIE 7.0" is the keyword. Test this script on older versions of IE to distinguish differences. Hope this helps! Quote Link to comment https://forums.phpfreaks.com/topic/85357-get_browser-function-how-does-it-work/#findComment-435547 Share on other sites More sharing options...
atl_andy Posted January 11, 2008 Share Posted January 11, 2008 use HTTP_SERVER_AGENT and search for MSIE and Firefox. It shouldn't matter which version is running. $browser = $_SERVER['HTTP_SERVER_AGENT']; $ie = "MSIE"; $ff = "Firefox"; strpos($ie, $browser) && strpos($ff, $browser); Quote Link to comment https://forums.phpfreaks.com/topic/85357-get_browser-function-how-does-it-work/#findComment-436159 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.