helloworld123
helloworld123

Reputation: 165

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

I am getting the above error when I host my Drupal site using MAMP. All of my HTML loads, but my CSS is not loading.

Refused to apply style from 'http://mysite/sites/default/files/css/css_Sr-zrzbdXHUuh75RQ_QtqOK_J8ztTYUGygU67gPw.css?f7d7s7' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

Upvotes: 5

Views: 13235

Answers (4)

Thomas
Thomas

Reputation: 119

I fixed my mime problem with the activation of both checkboxes on the drupal performance Page:

/admin/config/development/performance

enter image description here

Upvotes: 0

Carlos Junquera
Carlos Junquera

Reputation: 41

The agregated css are in sites/default/files/css directory.

The problem is the permissions in the files directory, sites/default/files should have 755 and have 750

You can change the permissions with:

chmod 755 sites/default/files

Upvotes: 2

ProGrammar
ProGrammar

Reputation: 294

I have a D8 site on pantheon (using a theme) and I was getting this problem when I created my local (using Lando). And the solution for me was to turn off CSS/JS aggregation on my local, then the page loaded fine:

drush -y config-set system.performance css.preprocess 0

drush -y config-set system.performance js.preprocess 0

Upvotes: 5

Ben
Ben

Reputation: 26

Steps to try:

-try to clear all caches

If that doesn't work:

-take a look at settings -> media -> filesytem. On this page you can find your temporary file path. Check if this is the correct path so your Drupal site writes these generated style files to the correct folder.

As you can see, your site is looking for this style file in /sites/default/files/. So this should be the path that is in the 'temporary file path' field.

Upvotes: 1

Related Questions