I just did a sandbox refresh from our production sandbox, and I am trying to make sure the community still works. In the community in production, we added static resource css files to the markup head in the following format:

<script  src="/resource/javascriptfilename" type="text/javascript"></script>
<link href="/s/sfsites/c/resource/cssfilename" rel="stylesheet" type="text/css" />

This was working in the production community, but after refreshing this other sandbox, none of the CSS or other scripts in the head markup is loading. They generate the error below:

Refused to apply style from <URL> because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

After looking at the mime type on the static resources, they are still the correct text/css or js mime types.

Is there some setting I need to enable to allow for the community to load these CSS and js files?



I had a similar issue. It turned out that the header was an HTML document that was stored in "Documents" in Salesforce Classic, and that was what was loading the scripts and CSS for the rest of the page. The Sandbox refresh I did from Prod did not contain those Documents, and so I had to copy them over into Salesforce Classic in dev, make the Documents visible for search, then go in and add the header and footer under Branding in the workspace.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.