Skip to content
This repository was archived by the owner on Mar 24, 2020. It is now read-only.

Commit 1c86c66

Browse files
committed
Adding test for IE9 in iframes
Internet Explorer 9 supports css3 media queries, but not within frames (this appears to be a bug in IE9). Modifying this script to check for IE9 and check if within iframe and run if true.
1 parent b21c578 commit 1c86c66

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
- Copyright 2011: Scott Jehl, scottjehl.com
55
- Dual licensed under the MIT or GPL Version 2 licenses.
66

7-
The goal of this script is to provide a fast and lightweight (3kb minified / 1kb gzipped) script to enable [responsive web designs](http://www.alistapart.com/articles/responsive-web-design/) in browsers that don't support CSS3 Media Queries - in particular, Internet Explorer 8 and under. It's written in such a way that it will probably patch support for other non-supporting browsers as well (more information on that soon).
7+
The goal of this script is to provide a fast and lightweight (3kb minified / 1kb gzipped) script to enable [responsive web designs](http://www.alistapart.com/articles/responsive-web-design/) in browsers that don't support CSS3 Media Queries - in particular, Internet Explorer 8 and under (and IE9 when inside a frame). It's written in such a way that it will probably patch support for other non-supporting browsers as well (more information on that soon).
88

99
If you're unfamiliar with the concepts surrounding Responsive Web Design, you can read up [here](http://www.alistapart.com/articles/responsive-web-design/) and also [here](http://filamentgroup.com/examples/responsive-images/)
1010

respond.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

respond.src.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ window.matchMedia = window.matchMedia || (function(doc, undefined){
4242
respond.mediaQueriesSupported = win.matchMedia && win.matchMedia( "only all" ).matches;
4343

4444
//if media queries are supported, exit here
45-
if( respond.mediaQueriesSupported ){ return; }
45+
if( respond.mediaQueriesSupported && !isIE9iframe() ){ return; }
4646

4747
//define vars
4848
var doc = win.document,
@@ -323,4 +323,12 @@ window.matchMedia = window.matchMedia || (function(doc, undefined){
323323
else if( win.attachEvent ){
324324
win.attachEvent( "onresize", callMedia );
325325
}
326+
//test for IE9 iframe
327+
function isIE9iframe() {
328+
var ua = navigator.userAgent,
329+
ie_version = -1;
330+
var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
331+
if (re.exec(ua) != null) ie_version = parseFloat( RegExp.$1 );
332+
return ( window != window.top && ie_version >= 9.0 );
333+
}
326334
})(this);

0 commit comments

Comments
 (0)