here is a simple example of a problem:
<html>
<head>
<link rel='stylesheet' href='myStyle.css'>
<script>
window.onload=function(){
try{
alert(document.styleSheets[0]);
alert(document.styleSheets[0].cssRules);
}catch(e){alert(e)}
}
</script>
</head>
<body>
</body>
</html>
myStyle.css body{background-color:green;}
script works fine if you used <style></style>
SOLUTIONS:
1. works when files are on the network / localhost
2. works with other browsers (i.e. Internet Explorer, Microsoft Edge, Firefox)
3. chrome --allow-file-access-from-files
source
share