scottjehl / Respond

A fast & lightweight polyfill for min/max-width CSS3 Media Queries (for IE 6-8, and more)
MIT License
11.33k stars 3.37k forks source link

IE8 gives access denied error #5

Closed jbeardmore closed 13 years ago

jbeardmore commented 13 years ago

CSS, js and site are all in the same domain, and there is no imported CSS. The only media queries are at the end of the CSS file and are as follows:

@media only screen and (min-width: 1164px){ .menu-main-container li{display:inline;position:relative;list-style:none;margin: 0 2.6%} }//mediaquery/

@media only screen and (max-width: 1088px){ .feature.right{padding-right:200px} }//mediaquery/

The error message is as follows (domain is removed):

Message: Access is denied.

Line: 7 Char: 1736 Code: 0 URI: http://******.com/js/respond.min.js

scottjehl commented 13 years ago

Hmm, got me. I've got Respond running on several different domains and haven't this message, myself. Shoot me a live link and I'll gladly take a look!

scottjehl commented 13 years ago

Oh, I'm assuming those closing comments comments are mashed by Git's comment system,yes?

scottjehl commented 13 years ago

Also, it'd help if you use the non-minified version to get a meaningful line #. Thanks!

jbeardmore commented 13 years ago

Hehe yes that's right, in the code the comments are correct.

Yeah I thought it was odd too, I can't see any reason for the error. Heres a live link.

http://stewartmorrison.pointydesign.com/

jbeardmore commented 13 years ago

Good point. Have switched to the non minified version.

jbeardmore commented 13 years ago

New error:

Message: Access is denied.

Line: 145 Char: 4 Code: 0 URI: http://stewartmorrison.pointydesign.com/wp-content/themes/stewartmorrison/js/respond.src.js

scottjehl commented 13 years ago

Looks like the google fonts (external domain) reference is throwing it. You might be able to load via JS instead: https://code.google.com/apis/webfonts/docs/webfont_loader.html

I opened a new issue to prevent ext-domain sheets from being parsed. Thanks!

jbeardmore commented 13 years ago

Ah, thats good to know, thanks! Loading the google font via js didnt help, however the main problem is that whether I remove the google fonts link or leave it, the media queries still don't work in IE at all. I'm stumped at this point.

scottjehl commented 13 years ago

I made a quick branch that should prevent non-same-domain hrefs from running through ajax (the cause of your error). Please test the umin'd src and see if it helps you. If so, I can probably roll this into master with a little more testing https://github.com/scottjehl/Respond/issues/#issue/6

scottjehl commented 13 years ago

jbeardmore: did you get a chance to test that update? Just curious if it helped any with your case.

voodoo6 commented 13 years ago

Hi, Using the main version 100644 (is this the version number!?) I get the same error as jbeardmore:

line:146 Char:4 Error: Access is denied

When I use the quick branch version you made - it prevents the above error occuring but it seems to stop the page's CSS loading/rendering properly?

You can see my current work in progress with this here (this is currently using the non-patched version): http://voodoo6.com/muscularclinic/

If it helps, I can upload the patched respond.js so you can see how the CSS loads improperly, let me know.

Thanks for your work on this, I hope these issues get sorted!

scottjehl commented 13 years ago

Voodoo6: so in your case, is it the typekit reference that causes the security error? Also, if you load respond.js in the head, does the error still occur?

voodoo6 commented 13 years ago

I've just tested locally..

Using the un-patched version: If i load respond.js in the head with typekit in place, the error still occurs, though the CSS loads fine. If i load respond.js in the head without typekit, I get no error but the CSS loads as though mediaquries are not being regcognised.

Using the patched version: Wether respond_patched.js is in the head or body the error stops but the CSS fails to load properly (it loads as though using the media queried styles) - both with and without typekit.

scottjehl commented 13 years ago

Interesting. Does the test.html page load fine for you in your version of IE?

voodoo6 commented 13 years ago

Test page loads and works fine :(

For what its worth, I'm testing IE using parallels on a mac running IETester on windows 7. If you have any suggestions, I'd be happy to try them- it would be great to get this working properly.

scottjehl commented 13 years ago

is your codebase portable? it'd be easiest to debug if I had it local, but if that's not possible, we can debug remotely.

One thing you might try (bit of a guess here...). On line 33, try changing this:

var sheets  = doc.styleSheets,

to this:

var sheets  = links,

Just curious to hear what that'll do.

voodoo6 commented 13 years ago

Changing that line doesn't seem to have any effect (still the error in the original version and CSS problem in the patched.)

The codebase is portable - its currently just static files - what is the best way to get it to you? I'll leave it as I've been using it (with respond.js in a plugins.js file).

scottjehl commented 13 years ago

can you toss a zip up on that domain you posted earlier? I'll take a look. Thanks

voodoo6 commented 13 years ago

Thanks scott, I appreciate your help. Let me know if theres anything else I can do.. I hope its not something too dumb that I've done! (link removed)

scottjehl commented 13 years ago

This looks like a pretty straight-forward setup so I'm not sure what could be causing trouble, but one thing I did notice was if you add and (min-width: 1px)

to your max-width queries, it seems to pick them up just fine. I'm not sure why this is yet, as logging out the conditions for min/max looks fine to me, and in my own work, I've used min and max queries exclusively of one another without trouble. But anyway, it seems like a little issue with the if/else conditions in my script.

Anyway, this quick fix may get you closer at least, until a fix is found! And stick with the branched version to prevent the non-same-domain error too btw. I'll try and roll that into master soon.

voodoo6 commented 13 years ago

The fix works fine, cheers Scott. I'll check back in the future to see how you're getting on with the script. Thanks again for the effort.

scottjehl commented 13 years ago

Hi all, This same-domain check was rolled into master today. Please grab (and test) the latest version (minified file is updated too). Thanks!