JoshBarr / on-media-query

A neat way to trigger JS when media queries change. No jQuery required.
283 stars 33 forks source link

Error: uncaught exception. Line 49. And no IE Support? #6

Closed mdmoura closed 12 years ago

mdmoura commented 12 years ago

Hello,

I have been trying js-media-queries and I found a few problems:

1)It does not work when I test the Index file in IE9, IE8, ... Could someone tell me what to change so I can support IE9, IE8, ...?

2)When I move the Queries Code and MQ.init(queries) I get the following error:

Timestamp: 16-06-2012 13:16:14 Error: uncaught exception: [Exception... "Operation is not supported" code: "9" nsresult: "0x80530009 (NS_ERROR_DOM_NOT_SUPPORTED_ERR)" location: "http://localhost:7136/scripts/onmediaquery.js Line: 49"]

Thank You, Miguel

JoshBarr commented 12 years ago

Hi Miguel,

1) I've had a quick look on a range of windows boxes (ie7/xp ie8/vista, ie9/windows7) and can't seem to reproduce your error. The code won't do anything in IE8, as IE8 doesn't support media queries and so it won't render the different values of CSS body:after. We haven't accounted for the case of using JS to back-fill media query support for browsers that aren't natively aware of media queries, as this seems to be against the philosophy of responsive web design.

2) If the script isn't at the bottom of the page, you should call the init function inside your favourite document.ready() method . This is usually how we use it. Otherwise you're trying to get the value of the body:after property before the browser has rendered it. I'll add a comment to the code.

Any more info you have about your IE9 test case would be awesome.

cheers,

Josh

mdmoura commented 12 years ago

Hello,

1) I think the error was originated by something else. I was able to solve it. And I am using Reponse to solve Media queries for the IE previous then 8.

2) Thanks. I solved it.

I will keep testing it. Any error I find I will report it.

Thank You, Miguel