We're looking for a person or people to help audit MDN to find places we could speed up. Is this you or someone you know? Check out the RFP: https://mzl.la/2IHcMiE

MediaQueryList Redirect 1

« MediaQueryList

This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for the proper prefixes to use in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers as the spec changes.

A MediaQueryList object maintains a list of media queries on a document, and handles sending notifications to listeners when the media queries on the document change.

This makes it possible to observe a document to detect when its media queries change, instead of polling the values periodically, if you need to programmatically detect changes to the values of media queries on a document.

Method overview

void addListener(MediaQueryListListener listener);
void removeListener(MediaQueryListListener listener);


Property Type Description
matches boolean true if the document currently matches the media query list; otherwise false. Read only.
media DOMString The serialized media query list.



Adds a new listener to the media query list. If the specified listener is already in the list, this method has no effect.

void addListener(
  MediaQueryListListener listener

Parameter (for addListener method)

The MediaQueryListListener to invoke when the media query's evaluated result changes.


Removes a listener from the media query list. Does nothing if the specified listener isn't already in the list.

void removeListener(
  MediaQueryListListener listener

Parameter (for removeListener method)

The MediaQueryListListener to stop calling on changes to the media query's evaluated result.

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support (Yes) 6.0 (6.0) 10 ? ?
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support ? ? ? ? ?


See also

Document Tags and Contributors

 Last updated by: Sheppy,