Closed Bug 210785 Opened 21 years ago Closed 21 years ago

@import only works using .css extension

Categories

(Core :: CSS Parsing and Computation, defect)

x86
Windows 2000
defect
Not set
minor

Tracking

()

VERIFIED INVALID

People

(Reporter: b-bonini, Assigned: dbaron)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3.1) Gecko/20030425
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3.1) Gecko/20030425

@import only works using *.css and will not work using for example *.css.php for
the inclusion of a dynamically generated style sheet. Opera and IE both handle
the @import this way with no issues. Could not find any specifics in the
recommendation regarding UA compliancy regarding this so it's entirely possible
Moz. is correct and everyone else is wrong, but, I suspect not. Of course most
scripting languages would include mechanisms by which the external sheet could
be imported into the current document but, seems like this shoudl work as well.

Reproducible: Always

Steps to Reproduce:
1. Try to use a style sheet via @import with an extension other then .css
2.
3.

Actual Results:  
Page broke, styles not recognized

Expected Results:  
treated the @import url("*.css.php"); just as it would @import url("*.css");
INVALID. It does work, so long as you use the text/css MIME type. Make sure your
non .css stylesheets aren't being sent back as, e.g., text/plain or text/html.

See http://devedge.netscape.com/viewsource/2003/mime-types/
Status: UNCONFIRMED → RESOLVED
Closed: 21 years ago
Resolution: --- → INVALID
<style type="text/css" xml:lang="en" lang="en">
@import url("site.css.php");
</style>

This is what I'm using and it does NOT work. I even explicitly set text/css css
php in apache to see what it would do and still no go. Your telling me the above
works for you? How can that be?
Status: RESOLVED → UNCONFIRMED
Resolution: INVALID → ---
What is the MIME type of site.css.php?

Can you give us a URI to check this with?

Do you get any messages in the increasingly misnamed JavaScript Console?
Mozilla uses the type set by the webserver, not the one you specify in the
style-tag (that's only a hint). See
http://www.w3.org/TR/html4/struct/links.html#adef-type-A . As usual IE works
differently.
Should be text/css

http://home.gfx-design.com:1467/~spi/new_site/test.php

No messages in JS console.

Have explicetly set text/css css php in webserver mime types config
It is indeed text/html, not text/css; here is a log of the headers sent for that
stylesheet:

   HTTP/1.1 200 OK
   Date: Thu, 26 Jun 2003 21:48:24 GMT
   Server: Apache-AdvancedExtranetServer/1.3.26 (Mandrake Linux/6.1mdk) 
    mod_ssl/2.8.10 OpenSSL/0.9.6g PHP/4.2.3
   X-Powered-By: PHP/4.2.3
   Connection: close
   Content-Type: text/html; charset=iso-8859-15

   body {
   ...

Notice the Content-Type line.
Status: UNCONFIRMED → RESOLVED
Closed: 21 years ago21 years ago
Resolution: --- → INVALID
So is it an apache issue? Even with 'text/css css php' set in the mime types config?
For php scripts you have to set the mime type from within the script; the mime
type of the php file as per .htaccess will probably have no effect.
brian: try <?php header( "Content-type: text/css" ); ?> in your php file
Status: RESOLVED → VERIFIED
But should not the main file, index.html or index.php output text/html? Are you
saying if a .css file is then called from within the parent doc another header
is sent that needs to be text/css?
Yes -- every file needs a correct MIME type. HTML files need text/html, CSS
files need text/css, PNG images need image/png, etc.
You know the more I think about this the more I'm convinced this can not
possibly work. You need to initially output text/html for the document to render
correctly and you MUST pass PHP header information before anything else so if
you were to initally set the mimetype to text/css the main document would not
render correctly and if you call php's header() function afterwards it results
in an error because headers have already been set. If there's a working example
of someone successfully using:
<style type="text/css" xml:lang="en" lang="en">
@import url("site.css.php");
</style>
I'd like to see it... I do not see how it's possible to use this scenario with
Mozilla. 
I don't know PHP, but this isn't a Mozilla bug.  You're sending two separate
files.  The MIME type on the HTML document must be text/html, and the mime type
on the stylesheet must be text/css.  If you can't control those separately using
PHP, then that's a PHP problem (although I think there are suggestions above).

However, in any case, it's not a Mozilla problem.  This is a bug system and not
a help/support system, so please don't comment further in Bugzilla unless you're
discussing problems in Mozilla (or other products for which one files bugs is
Bugzilla).
You need to log in before you can comment on or make changes to this bug.