Is it possible to detect media queries with javascript with out using Modernizr and similar libraries? I only need to see if media queries are there and maybe which widths.
EDIT:
My problem. I am making a chrome extension that need to be able to see if the current site is using media queries without having to re-size the viewport.
In a nut shell I just want to check if a site is using media queries with javascript alone. is that possible?
You could try checking for
CSSMediaRuleobjects within thedocument.styleSheetscollection. For example, the Modernizr website uses media queries, and we know this, so we can check by examining their stylesheet objects:Within this list we simply look for any
CSSMediaRule; we happen to find 3 on their site.