How to get the device width and height with JavaScript

Here’s a useful snippet for those who work with responsive designs. CSS Media Queries are cool and all but when you need it with JavaScript, here’s how to do it:

Viewport meta tag

You should also have this meta tag in your head section, this will give you a better experience on mobile browsers:

Learn more about the Viewport meta tag.

No comments yet, leave yours!

Leave a Reply

Add <code> Some Code </code> by using this tags.