While it's commonly advised to use feature detection over browser detection in JavaScript, sometimes specific scenarios call for the latter. An example of this can be seen with jQuery 1.9
's removal of $.browser
.
Despite the general recommendation against browser detection, I find myself facing a situation where I need to dynamically calculate the number of available "slots" in a JS layout. This calculation is done using calc(100%/{0})
, where {0}
represents the number of slots.
In the case of iPads, setting the height with .css("height", "calc(100%/3)")
will lead to failure since it requires the use of -webkit-
prefix.
Given this scenario, could someone guide me on how to implement feature detection instead of relying on outdated methods like $.browser.webkit
?