Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 721
sigmaxf Avatar asked Jan 06 '23 01:01

sigmaxf


2 Answers

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 === ""
like image 95
Tim Grant Avatar answered Jan 08 '23 15:01

Tim Grant


I think this answer should help you : jquery determine if css zoom is available in browser

The best way is to use a JS library dedicated to test browser CSS capabilities like Modernizr does.

like image 36
Gagoo Avatar answered Jan 08 '23 14:01

Gagoo