Questions tagged [browser-feature-detection]

Feature detection is the practice in web development of determining whether a browser or device supports a certain feature, so as to provide fallbacks for older browsers or allow enhanced functionality in more capable modern browsers.

Feature detection is the practice in web development of determining whether a browser or device supports a certain feature, so as to provide fallbacks for older browsers or allow enhanced functionality in more capable modern browsers.

154 questions
474
votes
17 answers

Detect if device is iOS

I'm wondering if it's possible to detect whether a browser is running on iOS, similar to how you can feature detect with Modernizr (although this is obviously device detection rather than feature detection). Normally I would favour feature detection…
SparrwHawk
  • 11,653
  • 21
  • 57
  • 89
36
votes
3 answers

How to detect HTML5 audio MP3 support?

I know how to check in Javascript if HTML5 audio playback is available. But how do I specifically check if MP3 audio playback is available, as IE9 and Chrome support it, while Firefox and Opera do not.
footy
  • 5,403
  • 12
  • 45
  • 95
26
votes
4 answers

How can I detect CSS Variable support with JavaScript?

The latest version of Firefox has support for CSS Variables, but Chrome, IE and loads of other browsers do not. It should be possible to access a DOM Node or write a little method which returns whether the browser supports this feature, but I…
25
votes
4 answers

Check browser CSS property support with JavaScript?

Is it possible in JavaScript to know if a CSS property is supported by the client browser? I'm talking about the rotation properties of CSS3. I want to execute some functions only if the browser supports them.
mck89
  • 17,869
  • 15
  • 83
  • 101
20
votes
3 answers

What's the difference between feature detection, feature inference, and using the UA string

I was asked this question in a job interview recently, specifically around Javascript. I was wondering the proper response. What exactly is the difference between feature detection, feature inference, and using the User agent string?
professormeowingtons
  • 3,355
  • 5
  • 31
  • 48
19
votes
3 answers

Which SVG support detection method is best?

Somebody has already asked my question about detecting SVG support in browsers but there are three leading solutions and not a lot of discussion about the merits of each. So: which, if any, is best? In terms of portability and correctness, that is.…
spraff
  • 29,265
  • 19
  • 105
  • 197
19
votes
3 answers

jQuery 1.9 browser detection

In earlier versions, I used to test if I should be triggering popstate manually on page load, because Chrome triggers it right after load, and Firefox and IE do not. if ($.browser.mozilla || $.browser.msie) { …
bevacqua
  • 43,414
  • 51
  • 157
  • 277
17
votes
2 answers

Detect if iOS is using webapp

I was wondering if it's possible to detect if an iOS user is using the webapp, or just visiting the normal way with safari browser. The reason I want to achieve is that on a iOS webapp when a user click on a link, he will get redirected to the…
koningdavid
  • 7,141
  • 4
  • 31
  • 46
17
votes
3 answers

How can I feature-detect CSS filters?

In some browsers, including Chrome stable, you can do this: h3 { -webkit-filter: grayscale(1); filter: grayscale(1); } And wouldn’t you know it, the h1 will be rendered completely in grayscale. Everything old is new again. Anyway — does anyone…
Alan H.
  • 15,001
  • 14
  • 74
  • 104
16
votes
3 answers

How can I "performance detect" browsers

Some mobile browsers and IE8 javascript is not just a little bit slower, it's many times 10x slower! There are lots of things that pass feature detection tests (js css manipulations, etc) but are so slow they degrade the user experience. Modernizr…
16
votes
6 answers

How to detect if mobile browser will show a "native" dropdown control?

I would like to check whether a browser is going to show a special "native" style dropdown (such as the iPhone and iPod) without checking specifically by browser name. Is it possible to check for that capability in a more generic way without…
Jason
  • 1,638
  • 15
  • 19
15
votes
2 answers

Easy way to detect support for transitionend event without frameworks like jQuery or Modernizr?

Have anybody out there found a simple way of detecting whether the browser supports the transitionend event or not in vanillaJs, especially in a way that actually works in all major browsers? :( I have found this unanswered thread in here: Test for…
hasse
  • 834
  • 1
  • 7
  • 21
13
votes
3 answers

How do I programmatically detect how a browser handles window.close()?

Different web browsers handle the window.close() function differently. IE prompts the user for confirmation, while Firefox and Safari just fail to honor it unless the window was originally opened with Javascript and display a message saying as much…
13
votes
3 answers

How to detect `focusin` support?

Thanks to Perfection kills, we can use the following JavaScript to detect event support: function hasEvent(ev) { var elem = document.createElement('a'), type = 'on' + ev, supported = elem[type] !== undefined; if (!supported)…
sdleihssirhc
  • 40,010
  • 5
  • 51
  • 67
1
2 3
10 11