Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialJohn Haas
1,756 PointsMedia queries don't work in IE8 and earlier. Any way to get around this?
I know media queries were only incorporated into IE9 and above. Are there any solid ways (for professional use) to utilize a javascript pluggin or something that mimics the media queries in these earlier browsers?
8 Answers
Alex Hedley
16,381 PointsYou could use Modernizr to check for features available http://modernizr.com
http://blog.restive.io/posts/4887492/css-media-queries-vs-restive-js
ivomiranda
30,286 PointsPlease forget IE8. There should be a law to forbid using IE8 and earlier versions. Even google dropped support to Jurassic browsers.
Make sure you get paid really good for supporting Jurassic versions of IE. Because you are basically working in something that is already obsolete therefore you are wasting your time in learning something that you will never use again.
John Haas
1,756 PointsI completely agree. Unfortunately, there are major businesses that still use that browser.
ivomiranda
30,286 PointsTrue. But it's a very specific niche. That's why I said make sure you are get well paid because that knowledge isn't going to be applied anymore in like 3 or 4 years.
Van Wilson
11,806 PointsIf you are looking for a basic, out-of-the-box solution, you could use Respond.js.
I usually start a project with the conditional comment code that Twitter Bootstrap recommends in their sample template, and supplement with more nuanced solutions like Modernizer if needed.
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
The html5shiv is technically not needed for media queries, but if you are using modern techniques like media queries, you probably also should allow yourself the freedom to use HTML 5 elements as well. I've often seen them paired together.
This may not solve all your IE 8 support issues, but it's a good start.
Good luck.
Daniel Kurowski
11,231 PointsI think even Microsoft stopped supporting IE8. Thank God for that - it's a sign ;)
John Ireland
6,585 PointsI'm currently collecting people for a mob, and together we will hunt down all those who use this dark technology known as "Internet Explorer", and modernize them. Anyone else down?
Michael Trilford
7,232 PointsI think the best way is to have an honest conversation with the business. Is it essential to put resource and budget into older browsers, rather than invest in other modern features to enhance the product further?
There is repond.js as mentioned above, but my goal these days are to only include additional code if absolutely necessary.
If I can serve a stacked mobile -esque layout to an IE6,7 & 8 user, then I will. They are on these devices to access content, and not much more than that.
Gerhard Driedger
7,486 PointsI don't think that anyone using an outdated browser should expect to have the same advantages that modern browsers have. When I play Final Fantasy 3 on SNES, I wont complain that the graphics don't compare to Final Fantasy 14 on a PS3. So I say let the dinosaurs die without responsive design.
Tony Brackins
28,766 PointsHere you go: https://code.google.com/p/css3-mediaqueries-js/ ie5+
John Haas
1,756 PointsJohn Haas
1,756 PointsAwesome thanks Alex. Would you personally go with restive over modernizr for responsive solutions? Any preference?