Reputation: 155
I am developing a website and it is working fine on all the browsers but Google Chrome. I need to set margin of an object just for Chrome. navigator.appName returns "Netscape" for both mozilla and chrome. navigator.appCodeName gives Mozilla for both browsers and userAgent returns this
"Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.4 (KHTML, like Gecko) Chrome/22.0.1229.94 Safari/537.4"
What should i do?
Regards
Upvotes: 0
Views: 108
Reputation: 49817
JUST if you are using jQuery you can use:
$.browser.webkit
Upvotes: 1
Reputation: 5666
Try something based on the userAgent property, the most reliable one:
var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
Upvotes: 1
Reputation: 9771
This returns true when using Chrome:
(/Chrome/).test(navigator.userAgent)
Upvotes: 1