Home > Article > Web Front-end > Why Can\'t I Access CSS Rules from Local Files in Chrome 64?
As Chrome 64 enforces a stricter Cross-Origin Resource Sharing (CORS) policy, developers now face restrictions in accessing CSS rules from local CSS files. This issue stems from the incongruity between Chrome's recent stance and the practices deemed acceptable by other browsers.
The Problem
The issue arises when attempting to access CSS rules from astylesheet loaded from the local file system. This action triggers a CORS error due to the variance in security origins between the HTML document and the CSS file. In Chrome 64 and subsequent versions, this behavior has been brought in line with the stipulations set forth in the CSS Object Model (CSSOM) specification.
Solutions
To circumvent this issue, developers have employed various workarounds:
TL;DR
Developers need to rely on local development servers or alternative browsers to access CSS rules from local CSS files while adhering to the new security measures implemented in Chrome 64. This limitation highlights the importance of same-origin policies and the need for secure web development practices.
The above is the detailed content of Why Can\'t I Access CSS Rules from Local Files in Chrome 64?. For more information, please follow other related articles on the PHP Chinese website!