Αναζήτηση στην υποστήριξη

Προσοχή στις απάτες! Δεν θα σας ζητήσουμε ποτέ να καλέσετε ή να στείλετε μήνυμα σε κάποιον αριθμό τηλεφώνου ή να μοιραστείτε προσωπικά δεδομένα. Αναφέρετε τυχόν ύποπτη δραστηριότητα μέσω της επιλογής «Αναφορά κατάχρησης».

Learn More

firefox won't load css file, due to incorrect MIME type.

  • 2 απαντήσεις
  • 16 έχουν αυτό το πρόβλημα
  • 36 προβολές
  • Τελευταία απάντηση από robbieB

more options

I am using dynamic css to rotate header background images. It requires the line:

echo "<style type='text/css' media='screen'> @import url('images/random-images/dynamic_css.php');</style>\n";

to be added between the <head> tags. The file 'dynamic_css.php' contains a line telling the browser that the file type is "text/css", but Firefox treats it as "text/html" and refuses to load it. If I duplicate the style declaration by also adding it outside of the head tags, Firefox loads it, but that causes other issues. What do I need to do to get Firefox to load the script from inside the head tags?

I am using dynamic css to rotate header background images. It requires the line: echo "<style type='text/css' media='screen'> @import url('images/random-images/dynamic_css.php');</style>\n"; to be added between the <head> tags. The file 'dynamic_css.php' contains a line telling the browser that the file type is "text/css", but Firefox treats it as "text/html" and refuses to load it. If I duplicate the style declaration by also adding it outside of the head tags, Firefox loads it, but that causes other issues. What do I need to do to get Firefox to load the script from inside the head tags?

Όλες οι απαντήσεις (2)

more options

That is probably because the server doesn't send a file with the php file extension as text/css.

Did you try to add a PHP header to make sure that the file gets send as text/css ?

Firefox may try to load such files from the cache and not reload them from the server.


A good place to ask questions and advice about web development is at the mozillaZine Web Development/Standards Evangelism forum.
The helpers at that forum are more knowledgeable about web development issues.

You need to register at the mozillaZine forum site in order to post at that forum.
See http://forums.mozillazine.org/viewforum.php?f=25

more options

Thanks cor-el.

The php file does include the line:

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

I'll follow up your suggestion re. the development forum.

robbie.

Τροποποιήθηκε στις από το χρήστη robbieB