Different browsers have different implementations of JavaScript. It's pretty common having to detect IE and to do something different for it, and in the case of WYSIWYG editors such as Xinha you also have to have ways of detecting Safari, and Opera as well as browser versions. Since Google's Chrome browser using the V8 JavaScript Engine you may find you need to tweak the odd few lines to work differently in that - and to do that you're likely going to want a way of detecting the browser. If we look at the User-Agent sent from the browser, we have:
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.2.149.27 Safari/525.13
So all we need to do is check for the presence of Chrome in the User-Agent.
var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
Remember though that it's not foolproof - people can spoof their User-Agent.













