1
votes

I ran into a safari problem considering cookie policy in iframes... Also I found a working solution for that, yet to make it work I need to determine in what browser user is viewing.

Original solution as to search in HTTP_USER_AGENT (django) word - safari. Problem here is:

Safari Windows XP on WM User Agent - Mozilla/5.0 (Windows NT 5.1) AppleWebKit/534.52.7 (KHTML, like Gecko) Version/5.1.2 Safari/534.52.7

Chrome Linux User Agent - Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.63 Safari/535.

So I'm struggling to find information what makes User Agent and how to parce it to get precise results. Sure in this case I can trow in extra if there is no word 'chrome', but what about chromium konqueror and any other minor browsers...

2

2 Answers

-1
votes

So I found that in User agent there can be any information you want.

There is some sort of abstract rules by witch you can determine a browser, yet those rules does not apply to all browsers.

During the browser wars, many web servers were configured to only send web pages that required advanced features to clients that were identified as some version of Mozilla. For this reason, most Web browsers use a User-Agent value as follows: Mozilla/[version] ([system and browser information]) [platform] ([platform details]) [extensions].

More @ http://en.wikipedia.org/wiki/User_agent

In my case I've looked at http://www.user-agents.org/ and determined that only Chrome impersonates Safari in the last section.

-2
votes

http://www.quirksmode.org/js/detect.html

Just search for the word Chrome, first, then search for Safari.