Welcome to WebmasterWorld Guest from 54.161.201.189

Forum Moderators: coopster & jatar k & phranque

FireFox: "css not loaded, because it's not text/css"

But it is!

   
11:47 pm on Sep 8, 2010 (gmt 0)

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Linux server, have text/css css in mime.types, even went as far as AddType text/css .css in httpd.conf. None of it fixed it.

This is a scheme I use often and have never encountered this. I have this document that needs different links based on browser. Easy enough, put a placeholder for the links, when requested an .htaccess directive rewrites to a script that determines the browser, opens the file, subs out the right links, then does

print "content-type:text/html\n\n";
print "$the_page";

Well enough . . . except I get the "css was not loaded because it's MIME type, "text/html", is not "text/css".

I don't get it. I know my script is overwriting the mime type somehow, but it outputs

<link rel="stylesheet" type="text/css" href="/path/to/style.css" />

As part of the page output, and doesn't even request the style sheet until the script exits. General structure,

/cgi-bin
/httpdocs
/httpdocs/pagedirectory

In .htacess at root (httpdocs)

RewriteRule ^pagedirectory\/([^/]*)\/*(.*) /cgi-bin/page-parser.cgi?d=$1&p=$2 [L]

(Typical structure might be /pagedirectory/layoutdirectory/index.html)

A further verification it's something to do with the script is that if I remove the rewrite, go directly to the file, it's fine. Well, all except for the placeholders for the links. :-P

Output validates to XHTML strict.
CSS validates to 2.1 without warnings.

As I've said, I've used this before, many times, open a template and output text/html . . . CSS has always linked fine. What can I be missing?
12:09 am on Sep 9, 2010 (gmt 0)

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



have you looked at the response headers?
perhaps your script and/or server is outputting multiple Content_type headers and the text/css one is being ignored.
1:15 am on Sep 9, 2010 (gmt 0)

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member



[SOLVED]

DOH what a dork. :-P

RewriteRule ^pagedirectory\/([^/]*)\/*(.*) /cgi-bin/page-parser.cgi?d=$1&p=$2 [L]

The bolded means *everything*. Including CSS. Which was being output as text/html by the script (and necessarily, too . . . DOH!) What a maroon. :-)

I'd overlooked it because I wanted to capture requests for /directoryname/ and directoryname/index.html . . . was too tired to remember it would capture directoryame/css/oops.css too.

<facepalm x 1000>
8:01 am on Sep 9, 2010 (gmt 0)

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



how humiliating!
i don't think i've ever overlooked a greedy regular expression.
=8)
 

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month