Home
> CSS, PHP, Web Design > PHP – Dynamic CSS Error – Stylesheet was not loaded because its MIME type…
PHP – Dynamic CSS Error – Stylesheet was not loaded because its MIME type…
When creating a dynamic css stylesheet you need to remember to include the header() to tell the stylesheet that it is of type text/css. If you do not include this then even if you include text/css in the stylesheet link, Firefox and other browsers will still assume the type is of text/html. If this occurs you will see the following from within Firefox’s error console. (Located under Tools > Error Console):
Error: The stylesheet http://localhost/ukshopdesign/inc/default.css.php was not loaded because its MIME type, "text/html", is not "text/css".
Source File: http://localhost/ukshopdesign/shopfront.php
Line: 0
To overcome this error place the following at the start of your dynamic css stylesheet:
header('Content-type: text/css');
Further Reading
Comments (0)
Trackbacks (0)
Leave a comment
Trackback