I need some function returning a boolean value to check if the browser is Chrome.
How do I create such functionality?
Update: Please see Jonathan’s answer for an updated way to handle this. The answer below may still work, but it could likely trigger some false positives in other browsers.
var isChrome = /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor);
However, as mentioned User Agents can be spoofed so it is always best to use feature-detection (e.g. Modernizer) when handling these issues, as other answers mention.
Answered By – Rion Williams
Answer Checked By – Willingham (BugsFixing Volunteer)