<p>As the title states, I'd be interested to find a safe feature-based (that is, without using navigator.appName or navigator.appVersion) way to detect Google Chrome.</p>

<p>By feature-based I mean, for example:</p>

<pre><code>if(window.ActiveXObject) {
    // internet explorer!
}
</code></pre>

<p><strong>Edit:</strong> As it's been pointed out, the question doesn't make much sense (obviously if you want to implement a feature, you test for it, if you want to detect for a specific browser, you check the user agent), sorry, it's 5am ;) Let me me phrase it like this: Are there any javascript objects and/or features that are unique to Chrome... </p>

[{'answer_id': 81121, 'author': 'Marijn', 'author_id': 12038, 'author_profile': 'https://Stackoverflow.com/users/12038', 'pm_score': 2, 'selected': False, 'text': "<p>Not exactly an answer to the question... but if you are trying to detect a specific browser brand, the point of feature-checking is kind of lost. I highly doubt any other browsers are using the Chrome userAgent string, so if your question is 'is this browser Chrome', you should just look at that. (By the way, window.ActiveXObject does not guarantee IE, there are plug-ins for other browsers that provide this object. Which kind of illustrates the point I was trying to make.)</p>\n"}, {'answer_id': 81179, 'author': 'micahwittman', 'author_id': 11181, 'author_profile': 'https://Stackoverflow.com/users/11181', 'pm_score': 1, 'selected': False, 'text': '<p>So, if you accept Marijn\'s point and <em>are</em> interested in testing the user agent string via javascript:</p>\n\n<p><code>var is_chrome = navigator.userAgent.toLowerCase().indexOf(\'chrome\') &gt; -1;</code></p>\n\n<p>(Credit to: <a href="http://davidwalsh.name/detecting-google-chrome-javascript" rel="nofollow noreferrer">http://davidwalsh.name/detecting-google-chrome-javascript</a> )</p>\n\n<hr>\n\n<p>Here\'s a really nice analysis/breakdown of the chromes user agent string: <a href="http://www.simonwhatley.co.uk/whats-in-google-chromes-user-agent-string" rel="nofollow noreferrer">http://www.simonwhatley.co.uk/whats-in-google-chromes-user-agent-string</a></p>\n'}, {'answer_id': 84699, 'author': 'pcorcoran', 'author_id': 15992, 'author_profile': 'https://Stackoverflow.com/users/15992', 'pm_score': 6, 'selected': True, 'text': '<pre><code>isChrome = function() {\n    return Boolean(window.chrome);\n}\n</code></pre>\n'}, {'answer_id': 84756, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 0, 'selected': False, 'text': '<p>You shouldn\'t be detecting Chrome specifically. If anything, you should be detecting WebKit, since as far as page rendering is concerned, Chrome should behave exactly like other WebKit browsers (Safari, Epiphany).</p>\n\n<p>If you need not only to detect WebKit, but also find out exactly what version is being used, see this link: <a href="http://trac.webkit.org/wiki/DetectingWebKit" rel="nofollow noreferrer">http://trac.webkit.org/wiki/DetectingWebKit</a></p>\n\n<p>But again, as other people said above, you shouldn\'t detect browsers, you should detect features. See this ADC article for more on this: <a href="http://developer.apple.com/internet/webcontent/objectdetection.html" rel="nofollow noreferrer">http://developer.apple.com/internet/webcontent/objectdetection.html</a></p>\n'}, {'answer_id': 582486, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 0, 'selected': False, 'text': "<p>One reason you might need to know the browser is Chrome is because it 'is' so damn standards compliant. I have already run into problems with old JavaScript code which I thought was standards compliant (by FF or Opera standards - which are pretty good), but Chrome was even more picky. It forced me to rewriting some code, but at times it might be easier to use the if(isChrome) { blah...blah ) trick to get it running. Chrome seems to work very well (I'm for standard compliance), but sometimes you just need to know what the user is running in grave detail.</p>\n\n<p>Also, Chrome is very fast. Problem is, some JavaScript code unintentionally depends on the slowness of other browsers to work properly, ie: page loading, iframe loading, placement of stylesheet links and javascript links in page head, etc. These can cause new problems with when functions are really available to interact with page elements. So for now, you really might need to know...</p>\n"}, {'answer_id': 582823, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 2, 'selected': False, 'text': '<p>For all the standards nazis... sometimes you might want to use bleeding "standard technologies" which aren\'t just yet standard but they will be... Such as css3 features.</p>\n\n<p>Which is the reason why I found this page.</p>\n\n<p>For some reason, Safari runs a combo of border-radius with box-shadow just fine, but chrome doesn\'t render the combination correctly.  So it would be nice to find a way to detect chrome even though it is webkit to disable the combination.</p>\n\n<p>I\'ve ran into hundreds of reasons to detect a specific browser/version which usually ends up in scrapping an idea for a cool feature because what I want to do is not supported by the big evil...</p>\n\n<p>But sometimes, some features are just too cool to not use them, even if they aren\'t standardized yet.</p>\n'}, {'answer_id': 686616, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 0, 'selected': False, 'text': '<p>I use this code to make bookmarks for each browser (or display a message for webkit)</p>\n\n<pre>\nif (window.sidebar) { \n// Mozilla Firefox Bookmark\nwindow.sidebar.addPanel(title, url,"");\n} else if( window.external ) { // IE Favorite\n  if(window.ActiveXObject) {\n  //ie\n  window.external.AddFavorite( url, title);\n  } else {\n  //chrome\n  alert(\'Press ctrl+D to bookmark (Command+D for macs) after you click Ok\');\n  }\n} else if(window.opera && window.print) { \n// Opera\n  return true; }\n else { //safri\n alert(\'Press ctrl+D to bookmark (Command+D for macs) after you click Ok\'); }\n\n</pre>\n'}, {'answer_id': 2855010, 'author': 'Jan Turoň', 'author_id': 343721, 'author_profile': 'https://Stackoverflow.com/users/343721', 'pm_score': 3, 'selected': False, 'text': '<p><sub><strong>This answer is very outdated</strong>, but it was very relevant back then in the stone age.</sub></p>\n\n<p>I think feature detect is more usefull than navigator.userAgent parsing, as I googled Opera ambiguosity <a href="http://www.javascriptkit.com/javatutors/navigator.shtml" rel="nofollow noreferrer" title="here">here</a>. Nobody can know if IE16 will parse the /MSIE 16.0;/ regexp - but we can be quite sure, there will be the document.all support. In real life, the features are usually synonyms for the browsers, like: <em>"No XMLHttpRequest? It is the f....d IE6!"</em>\nNo nonIE browser supports document.all, but some browsers like Maxthon can scramble the userAgent. (Of course script can define document.all in Firefox for some reason, but it is easilly controllable.) Therefore I suggest this solution.</p>\n\n<p><strong>Edit</strong> <a href="http://www.javascriptkit.com/javatutors/objdetect3.shtml" rel="nofollow noreferrer" title="Here">Here</a> I found complete resources.</p>\n\n<p><strong>Edit 2</strong> I have tested that document.all is also supported by Opera!</p>\n\n<pre><code>var is = {\n  ff: window.globalStorage,\n  ie: document.all &amp;&amp; !window.opera,\n  ie6: !window.XMLHttpRequest,\n  ie7: document.all &amp;&amp; window.XMLHttpRequest &amp;&amp; !XDomainRequest &amp;&amp; !window.opera,\n  ie8: document.documentMode==8,\n  opera: Boolean(window.opera),\n  chrome: Boolean(window.chrome),\n  safari: window.getComputedStyle &amp;&amp; !window.globalStorage &amp;&amp; !window.opera\n}\n</code></pre>\n\n<p>Using is simple:</p>\n\n<pre><code>if(is.ie6) { ... }\n</code></pre>\n'}, {'answer_id': 2855192, 'author': 'lunixbochs', 'author_id': 293352, 'author_profile': 'https://Stackoverflow.com/users/293352', 'pm_score': 1, 'selected': False, 'text': '<p>I often use behavior/capability detection. Directly check whether the browser supports functionality before working around it, instead of working around it based on what might be the browser\'s name (user-agent).</p>\n\n<p>A problem with browser-specific workarounds, is you don\'t know if the bug has been fixed or if the feature is supported now. When you do capability detection, you <em>know</em> the browser does or doesn\'t support it directly, and you\'re not just being browser-ist.</p>\n\n<p><a href="http://diveintohtml5.ep.io/everything.html" rel="nofollow noreferrer">http://diveintohtml5.ep.io/everything.html</a></p>\n'}, {'answer_id': 3197366, 'author': 'Kean', 'author_id': 385799, 'author_profile': 'https://Stackoverflow.com/users/385799', 'pm_score': -1, 'selected': False, 'text': '<p>isIE: !!(!window.addEventListener &amp;&amp; window.ActiveXObject),</p>\n\n<p>isIE6: typeof document.createElement(\'DIV\').style.maxHeight == "undefined",</p>\n\n<p>isIE7: !!(!window.addEventListener &amp;&amp; window.XMLHttpRequest &amp;&amp; !document.querySelectorAll),</p>\n\n<p>isIE8: !!(!window.addEventListener &amp;&amp; document.querySelectorAll &amp;&amp; document.documentMode == 8),</p>\n\n<p>isGecko: navigator.product == \'Gecko\',</p>\n\n<p>isOpera: !!window.opera,</p>\n\n<p>isChrome: !!window.chrome,</p>\n\n<p>isWebkit: !!(!window.opera &amp;&amp; !navigator.taintEnable &amp;&amp; document.evaluate &amp;&amp; navigator.product != \'Gecko\'),</p>\n'}, {'answer_id': 50942571, 'author': 'ugur akkurt', 'author_id': 7496956, 'author_profile': 'https://Stackoverflow.com/users/7496956', 'pm_score': 0, 'selected': False, 'text': '<p>There might be false positives since opera also has <code>window.chrome</code> object. As a nice solution I use;</p>\n\n<pre><code>var isOpera = !!window.opera || !!window.opr;// Opera 8.0+\n\nvar isChrome = !!window.chrome &amp;&amp; !isOpera;\n</code></pre>\n\n<p>This solution almost always works. \nHowever one thing I discovered is that, <code>isChrome</code> returns <code>false</code> in iPad Chrome version 52.0 as <code>window.chrome</code> returns <code>false</code>. </p>\n'}]
['https://Stackoverflow.com/questions/81099', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/14981/']