A few days ago I've faced with a problem of getting cssRules data on a webpage.
document.styleSheets[i].cssRules
Works only for style tags and link tags with same domain style sheet path.
So, it's pretty hard to access these rules if I use style sheets from different domains,
Or if I browse html pages from local file system - it's impossible to access the rules even from local filesystem style sheet, and also web-located style sheet. in another words - it's impossible to get rules from any stylesheet from local fs html page.
and also it's impossible to get rules if i use data urls, for example:
<link rel="stylesheet" href="data:text/css;base64,Kntjb2xvcjpyZWQ7fQ==">
I do not know why this unfair behaviour appears, but i hope someday i'll realize true reasons of these restrictions.
Because I do not really understand why to prevent js access to css rules when the browser itself accesses and renders them without any problems (crossdomain, local filesystem, etc.)
any suggestions on how to access these rules anyway?
In my case i write an js extension that works on every web site (so I cannot simply move required css to my domain).