so if there is an external css file like:
<link rel='stylesheet' type='text/css' href='test.css'>
and we want to read the syle sheet using javascript, we can do it like:
document.styleSheets[0].cssRules[0].cssText; (for example for first rule)
It works fine in firefox, but the same statement give’s error in chrome, with something like Type Error: "non_object_property_load".
What could be the problem and how can we read style sheet in chrome?
Please have a look at the issue i am facing:
http://s4.postimage.org/x5q0xt1vh/file.png
EDIT: So the problem comes when the test file and linked css are placed locally on the system and are not access through webserver.
Ok I found the problem. It was indeed security related, which works if the external css is in the same directory for firefox but does not work for chrome.
If css file is in another directory or online, it will not work in firefox as well.
Now to solve this problem, i started chrome with arguments
--allow-file-access-from-filesand now it is working perfectly fine as it should.