Using Modernizr to test for tablet and mobile – Opinions wanted

This question is a bit old but I couldn’t find a better answer when I googled it.

Most desktops now are touch enabled, so detecting it is irrelevent.

The best way to detect them is by screen size.

With Modernizr you can use if (Modernizr.mq('only all and (max-width: 480px)')) { ...}

Leave a Comment