raphadko raphadko - 1 year ago 102
Linux Question

jQuery detect if browser support Zoom

How can I check if the browser supports the Zoom css atribute? I know from Caniuse.com that only Firefoz does not support it, so, from this question (In Javascript, how do I determine if my current browser is Firefox on a computer vs everything else?) I tried:

if ($.browser.mozilla) { ...

which returns me an error in chrome:

Cannot read property 'mozilla' of undefined

Another solution according to the answer is detectinf if the browser supports that function, how could I do that?

Answer Source

Here is how you could detect support for a CSS feature in plain JavaScript. (Replace zoom with whatever feature is needed.)

document.createElement("detect").style.zoom === ""