Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
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
Comment #1
nedjoHmm. 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?
Comment #2
ankigupt CreditAttribution: ankigupt commentedHello,
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.
Regards,
Ankit Gupta
Comment #3
ankigupt CreditAttribution: ankigupt commentedHello,
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
Comment #4
Alan McEwen CreditAttribution: Alan McEwen commentedI 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.
Comment #5
msbjhandeer CreditAttribution: msbjhandeer commentedhi lads, none of the above solution has solved my problem. problem is i think arising from popup menu. how do i fix it.
Comment #6
robin_b CreditAttribution: robin_b commentedThe 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;
}
}
Comment #7
defigo CreditAttribution: defigo as a volunteer commentedThe 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."
Comment #8
dlaufer CreditAttribution: dlaufer as a volunteer and commentedThis can be done with drush:
After this, my local was working fine (the only environment I had this problem).
Comment #9
codedrill CreditAttribution: codedrill as a volunteer commentedSolution by "dlaufer" worked for me in Drupal 8
Comment #10
tpsiru CreditAttribution: tpsiru as a volunteer commentedPlease Un check
Aggregate CSS files
Aggregate JavaScript files
if checked and then clear the cache.
Comment #11
zuernBernhard CreditAttribution: zuernBernhard at UEBERBIT GmbH commentedaggregation is of - problem persists
Comment #12
Rob C CreditAttribution: Rob C commentedJust 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.
Comment #13
samhaldia CreditAttribution: samhaldia as a volunteer and commentedCheck 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
Comment #14
poryblunkettroyle CreditAttribution: poryblunkettroyle as a volunteer commenteddlaufer has the solution for issues regarding Drupal 8.x
Comment #15
Boldizart CreditAttribution: Boldizart commentedSolution #8 worked for me! Thanks
Comment #16
hamadknows CreditAttribution: hamadknows as a volunteer commentedThank 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.
Comment #17
vasna sdoeung CreditAttribution: vasna sdoeung commentedunchecking 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.
Comment #18
viappidu CreditAttribution: viappidu commentedKudos to Alan for #4, this solved my problem
Comment #19
Coop920 CreditAttribution: Coop920 commented#8 worked for me, thank you!
Comment #20
ldenna CreditAttribution: ldenna commented#8 worked for me on mac, thank you!
Comment #21
shobhit_juyal CreditAttribution: shobhit_juyal commentedShould 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...
Comment #22
anuradha.zinjade CreditAttribution: anuradha.zinjade as a volunteer and commented#10 Work for me.
Comment #23
vamirbekyan CreditAttribution: vamirbekyan commentedD9:
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.
Comment #24
AswathyAjish CreditAttribution: AswathyAjish commented#8 worked for me in drupal 8. Thanks a lot.
Comment #25
pablo.fredes CreditAttribution: pablo.fredes as a volunteer and at Globant commentedMy problem was the permissions in the files directory
sites/default/files should have 755
chmod 755 sites/default/files
Comment #26
Slim Ch CreditAttribution: Slim Ch as a volunteer commentedSame problem, #8 resolved this issue !