matchMedia
Widely available since 2018-01-29
The window.matchMedia()
method checks whether a media query applies to the document.
Learning resources on MDN
- MediaQueryList
- MediaQueryList: change event
- MediaQueryList: matches property
- MediaQueryList: media property
- MediaQueryListEvent
- MediaQueryListEvent: MediaQueryListEvent() constructor
- MediaQueryListEvent: matches property
- MediaQueryListEvent: media property
- Window: matchMedia() method
Browser support (view on caniuse.com)
- Chrome 9 Released on 2011-02-03
- Chrome Android 18 Released on 2012-06-27
- Edge 12 Released on 2015-07-29
- Firefox 6 Released on 2011-08-16
- Firefox for Android 6 Released on 2011-08-16
- Safari 5.1 Released on 2011-07-20
- Safari on iOS 5 Released on 2011-10-12