browser-detection
IE8 css selector [duplicate]
I’m not going to get in a debate about whether or not this method should be used, but this will let you set specific css attributes for IE8-9 only (note: it is not a selector, so a bit different than what you asked): Use ‘\0/’ after each css declaration, so: #nav li ul { left: … Read more
How to target Edge browser with javascript
Try to detect features instead of a specific browser. It’s more future-proof. Only rarely should you use browser detection. With that out of the way: one option is to use a library (there are many intricacies to User Agent strings), or alternatively to parse window.navigator.userAgent manually. Using a parser library # https://github.com/faisalman/ua-parser-js. var parser = … Read more
Javascript IE detection, why not use simple conditional comments? [duplicate]
James Padolsey put a little snippet on GitHub that I’ll quote here: // ———————————————————- // A short snippet for detecting versions of IE in JavaScript // without resorting to user-agent sniffing // ———————————————————- // If you’re not in IE (or IE version is less than 5) then: // ie === undefined // If you’re in … Read more
What’s the replacement for $.browser
Based on jQuery migration plugin , I found this. jQuery.uaMatch = function( ua ) { ua = ua.toLowerCase(); var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) || /(webkit)[ \/]([\w.]+)/.exec( ua ) || /(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) || /(msie) ([\w.]+)/.exec( ua ) || ua.indexOf(“compatible”) < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) || []; return { browser: match[ … Read more
Rails Browser Detection Methods
The browser gem is specifically designed for browser detection in Rails.
Browser detection
if (Request.Browser.Type.Contains(“Firefox”)) // replace with your check { … } else if (Request.Browser.Type.ToUpper().Contains(“IE”)) // replace with your check { if (Request.Browser.MajorVersion < 7) { DoSomething(); } … } else { }
How do you detect support for VML or SVG in a browser
I’d suggest one tweak to crescentfresh’s answer – use document.implementation.hasFeature(“http://www.w3.org/TR/SVG11/feature#BasicStructure”, “1.1”) rather than document.implementation.hasFeature(“http://www.w3.org/TR/SVG11/feature#Shape”, “1.0”) to detect SVG. WebKit is currently very picky about reporting features, and returns false for feature#Shape despite having relatively solid SVG support. The feature#BasicStructure alternative is suggested in the comments to https://bugs.webkit.org/show_bug.cgi?id=17400 and gives me the answers I expected on … Read more
Easiest/Lightest Replacement For Browser Detection jQuery 1.9?
I’ve use the following code answered by Alexx Roche, but i wanted to detect MSIE so: <script type=”text/javascript”> $(document).ready(function() { if (navigator.userAgent.match(/msie/i) ){ alert(‘I am an old fashioned Internet Explorer’); } }); </script> hope it helps!
How to detect browser with Angular?
I have used this before and it worked well. const isIEOrEdge = /msie\s|trident\/|edge\//i.test(window.navigator.userAgent)