Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ElementQueries can't read cross-origin stylesheets #102

Closed
eschatonic opened this issue Mar 23, 2016 · 2 comments
Closed

ElementQueries can't read cross-origin stylesheets #102

eschatonic opened this issue Mar 23, 2016 · 2 comments

Comments

@eschatonic
Copy link

We're using a CDN to host our stylesheets, unfortunately this appears to prevent ElementQueries from working.

It seems that when using stylesheets on an alternate domain, the .cssRules and .rules properties of those stylesheets are not accessible due to cross-origin issues (cf. http://stackoverflow.com/q/5678040), meaning that the readRules() function simply skips the stylesheet.

For some reason this appears to affect latest Firefox and Chrome but not Internet Explorer 11.

Here's an example of an affected stylesheet's property list.
cssrulesnull

I understand from #16 that there is currently no support for loading cross-domain resources; is this still the case?

@marcj
Copy link
Owner

marcj commented Apr 25, 2016

Yes, unfortunately Browser don't accept that. You can try to set the Access-Control-Allow-Origin header on your CDN, to allow your actual website to read all resources from that CDN. https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS

@marcj marcj closed this as completed Apr 25, 2016
@DrDeath72
Copy link

Access-Control-Allow-Origin didn't help :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants