Javascript trouble accessing cross-domain CSS file

The above link shows my attempt to read a CSS file hosted on a CDN.

Why won’t it work and what can I do?

I have access to all and everything, so can change anything.

I have tried to implement CORS, but no luck.

I’ve just tried a few things and did some research and it seems that this is something purposefully implemented do avoid XSS type attacks. (In fact, the issue that it was allowed was lodged as a bug in Webkit and fixed a few years ago - they were modelling this behaviour after Firefox who’d already implemented it.)

Is there any particular reason you need to access the style rules in an external stylesheet? (And if it’s important to do so, why not host the CSS file yourself?)

If you need to know the styles associated with a particular element you can always use:

window.getComputedStyle( ele ).getPropertyValue( propVal ); //where ele is a DOM element propVal is a CSS property