A webpage is being hosted by apache2, CentOS 6.2.

It Gets HTML, CSS, JS files ok to the client side. But CSS and JS don't render, What can be hapenning? Since they should run 100% on client side...

up vote 13 down vote accepted

The mime types are probably wrong.

Check they're serving the content with Content-type: text/javascript or Content-type: text/css. You can check this using the Network tab of Chrome's Inspector or Firebug.

You'll need mod_mime, and ensure you have these lines in your httpd.conf:

AddType text/css .css
AddType text/javascript .js

That should do it.

  • Yes, you are right! most of them are 'Content-type: text/plain' Any tip on how to change them? – jacktrades Jul 5 '12 at 22:42
  • Please see my edits. You can also put those lines in a .htaccess if you really have to, but will still need mod_mime. – Jay Jul 5 '12 at 22:51
  • It was enabled, added those lines. You are a Genius! – jacktrades Jul 5 '12 at 22:57
  • 2
    Nah, just someone who's had exactly the same problem in the past ;-) But thanks! – Jay Jul 5 '12 at 23:10

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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