HRESULT matchMedium( BSTR mediaQuery, VARIANT_BOOL *matches );
- [in] The media query to match.
- [out, retval] A VARIANT_BOOL value that indicates whether the media type of the object matches the media type that the mediaQuery parameter specifies.
Returns S_OK if successful, or an error value otherwise.
The mediaQuery parameter can contain a string that specifies one of the following media types, an optional well-formed Cascading Style Sheets (CSS) media query, or both.
allThe display object supports all media types.
screenThe display object supports computer screens.
Internet Explorer 9 introduces support for media queries. Media queries enable you to scope a style sheet to a set of precise device capabilities. For instance, you might want to design pages differently for users who browse on a mobile device (that has a very small screen, limited color palette, low resolution, and so on) versus a netbook (that has a small screen, full color palette, high resolution, and so on) versus a standard computer (that has a large screen, full color palette, high resolution, and so on).
A media query consists of a media type ( sMediaType ) and zero or more expressions ( sMediaFeatures ) that check for the conditions of particular media features. A media query is a logical expression that is either true or false. A media query is true if the media type of the media query matches the media type of the computer on which Internet Explorer is running, and all expressions in the media query are true. Internet Explorer 9 supports the following media features:
For more information, see the World Wide Web Consortium (W3C) specification CSS3 Media Queries Module and the Internet Explorer 9 demo Internet Explorer Test Drive: CSS3 Media Queries. For information about how to use Media Queries, see CSS3 Media Queries on the IEBlog, and Respond to Different Devices With CSS3 Media Queries on Script Junkie.