Reputation: 921
I use Sys.Browser.name
for borwser detection, but Chrome detected as safari.
Upvotes: 3
Views: 422
Reputation: 28125
That is because you're checking for "webkit", which happens to exist in both safari and chrome.
Chrome
5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.224 Safari/534.10
Safari
5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/533.19.4 (KHTML, like Gecko) Version/5.0.3 Safari/533.19.4
Ensure that it is webkit (as I guess you're doing already) and also check for "Chrome
".
Edit: What exactly is your code platform? Sys.Browser.Name
doesn't sound familiar to me. Also, what is the exact code you're using?
Edit 2: You still didn't mention what code you are using. 1. I don't have .NET here. 2. I can't code it up for you right now. 3. I need to see you doing the comparison. 4. I largely forgot how C#/VB works, so seeing your code will great help out.
Without more info, I can't help more than that, sorry.
Upvotes: 1
Reputation: 737
A quick google search turned up this page: http://davidwalsh.name/detecting-google-chrome-javascript
Basically, read the full user-agent and find the string 'chrome':
var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
Upvotes: 3