I've enabled wforms and jsutils, but i get this error in my javascript console.

Error: The stylesheet http://knack.staging.d2p.com.au.../node/add/modules/jstools/wforms/lib/w... was not loaded because its MIME type, "text/html", is not "text/css".

any ideas?

Comments

nedjo’s picture

Hmm. This may be a server issue, i.e., you need to set your server to give .css files the text/css mime type. I don't know why it would complain for this and not other stylesheets. Does the page work as expected?

ankigupt’s picture

Hello,

I also faced the issue.

This is not a system configuration issue but it is development issue.

As most of the CMS use some configuration like generating files thorugh php.

for generating url:

http://test.drupal.org/index.php/lsjkldfjs/lsjfljs/test.html
we have the mime type test/html

but when css is generated dinamically

http://test.drupal.org/index.php/lsjkldfjs/lsjfljs/test.css

then the page index.php is not having the code to change the mime type.

For ones knowledge we can change the header of reponse. This is generally done when creating the custom images like captcha.

One can do this.

header('Content-type: test/css');

Regards,

Ankit Gupta

ankigupt’s picture

Hello,

I am a linux SA. So may be my tendency is to put work on development side.

Thats my fault.

I thought if the css is generated through php file then we can do the above.

But after some time of the old issue I saw the issue again with a static css file so not a development issue.

It started coming as firefox is updated and now it checks very strictly that the content-type of .css should be text/css not text/html nor text/plain etc.

please add a line in your apache configuration file

AddType text/css .css

And everything will work fine.

Regards,

Ankit Gupta

Alan McEwen’s picture

I found the solution on this website: http://forums.formtools.org/showthread.php?tid=1062

Essentially, you unset the default mime type in your php.ini file, as in:
default_mimetype = ""

After this, the drupal css loaded properly.

msbjhandeer’s picture

hi lads, none of the above solution has solved my problem. problem is i think arising from popup menu. how do i fix it.

robin_b’s picture

The mime-type of the css file is returned as "text/plain" to the browser and not as "text/css". Most browsers don't care about that, but Firefox does care and ignores the css (a bit harsh). If you're using Nginx as webserver (instead of Apache), the cause will probably be in your nginx configuration.

The Nginx config file should contain a link to the default mime-types. Make sure the link isn't in comments.
http {
include /etc/nginx/mime.types;
}

OR, add this:
http {
types {
text/css css;
}
}

defigo’s picture

Issue summary: View changes

The solution can be found here: https://www.drupal.org/forum/support/installing-drupal/2015-12-31/drupal...

What you need to do is "In Drupal go to configuration > Performance > Uncheck Aggregate CSS & Aggregate Javascript."

dlaufer’s picture

This can be done with drush:

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

After this, my local was working fine (the only environment I had this problem).

codedrill’s picture

Solution by "dlaufer" worked for me in Drupal 8

tpsiru’s picture

Please Un check
Aggregate CSS files
Aggregate JavaScript files

if checked and then clear the cache.

zuernBernhard’s picture

aggregation is of - problem persists

Rob C’s picture

Just an idea: Check if the file actually exists. (visit the path) Chrome is nasty and gives this message if files return a 404 in some cases.

samhaldia’s picture

Check the library url http://drupal/modules/xxx/css/xxx.css?paz2n4, whether it is giving 404? If it is please cross check the library name you want to attach

poryblunkettroyle’s picture

dlaufer has the solution for issues regarding Drupal 8.x

Boldizart’s picture

Solution #8 worked for me! Thanks

hamadknows’s picture

Thank You Solution #7 Work's for me , Actually i faced the issue just after enabling a permission for anonymous users.
As i have Unchecked Configuration > Performance > JavaScript and CSS.
But why it happened.

vasna sdoeung’s picture

unchecking the javascript/css is a temporary solution and the site performance will be sacrificed. Sadly it involves the permission on the folders at /sites/default/files and /tmp. Should see https://www.drupal.org/node/2622026 for the full solution.

viappidu’s picture

Kudos to Alan for #4, this solved my problem

Essentially, you unset the default mime type in your php.ini file, as in:
default_mimetype = ""

Coop920’s picture

#8 worked for me, thank you!

ldenna’s picture

#8 worked for me on mac, thank you!

shobhit_juyal’s picture

Should we really consider #7 or #8 as solutions !! Aren't they just skipped the aggregation tool ?
Better if we could find out the exact cause - https://www.drupal.org/forum/support/module-development-and-code-questio...

anuradha.zinjade’s picture

#10 Work for me.

vamirbekyan’s picture

D9:
while #7, #8 and #10 are all the same "solution" as shobhit_juyal pointed out it is just skipping aggregation. I am running into issues with CDN module. Once I turn on aggregation the Content-type header is no longer valid for CSS, JS and SVG files. I tried #4 but it did not help. Pls advise.

AswathyAjish’s picture

#8 worked for me in drupal 8. Thanks a lot.

pablo.fredes’s picture

My problem was the permissions in the files directory

sites/default/files should have 755 

chmod 755 sites/default/files

Slim Ch’s picture

Same problem, #8 resolved this issue !