Skip to content

Loading…

CSS Cross-Domain loading in Chrome and Safari is broken #53

Closed
manuelschneider opened this Issue · 3 comments

4 participants

@manuelschneider

It seems Webkit always hit the 10-seconds timeout when loading a CSS-File from another Domain.

I guess the reason is, that in line 138 those browser won't fire a security-exception for link.sheet - the element is just empty.

I created Demos to help understanding the problem:

http://sellaround.efreetsystems.de/yepnope/bugDemo.html
http://sellaround.efreetsystems.de/yepnope/bugDemoFixed.html

NOTE: The interesting part here is the JS-Callback - the CSS applies of course as soon as it's loaded.

I created a patch which should fix this:

  138c138,139
  <               if ( link.sheet.cssRules.length )  {
  ---
  >               // Chrome won't throw a security or denied exception in case of same origin - cssRules will simply stay empty
  >               if ( (isWebkit && link.sheet !== null) || (isGecko && link.sheet.cssRules.length) ) {

I tested it with Safari 5.1 and Chrome 12.

Last but not least: Thank you for this great tool!

@SlexAxton
Owner

Cool! Thanks for the work on this. Any chance you wanna do a pull request so you get the credz in the log?

@SlexAxton
Owner

@ralphholzmann - you put this fix in the v1.1 stuff, yes? Either way, when we take out the CSS callbacks by default, let's make sure this fix is in the new plugin to support this. We won't pull this into master since we're changing the way it works, but it'll be fixed in the appropriate spot. Many thank yous.

@magus424

did this not make it into the CSS plugin? cross domain CSS is currently broken in Safari w/the plugin

@SlexAxton SlexAxton closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.