views:

195

answers:

5

Is there any way of pulling in a CSS stylesheet into FireFox 2 or 3 that is not a static file?

Bellow is the code we are using to pull in a stylesheet dynamically generated by a CGI script.

<link rel="stylesheet" href="/cgi-bin/Xebra?ShowIt&s=LH4X6I2l4fSYwf4pky4k&shw=795430-0&path=customer/DEMO/demo1.css" type="text/css">

/cgi-bin/Xebra?ShowIt&s=LH4X6I2l4fSYwf4pky4k&shw=795430-0&path=customer/DEMO/demo1.css

Note that the URL above that pulls in the CSS does not end with .css rather the parameters do.

+5  A: 

Is the Content Type from the server the correct one for the file that is served up?

Content-type: text/css
scunliffe
To be clear, your headers should contain "Content-type: text/css"
Greg
I believe this to be the answer, I'm gonna let the guys try it out first before I select the right answer.
leeand00
no problem, let us know if you have any issues
scunliffe
+3  A: 

why isn't this working? Double check that the response header for the cgi script has

Content-Type: text/css
Cipher
+3  A: 

The extension doesn't matter but you should make sure the content type is "text/css".

Cristian Libardo
A: 

I've done the same thing in the past - a former employer's site uses a link tag much like yours, and works fine in FF2 at least (I just checked it, though I tested it in FF when we added that link). If it's not working, I'd suspect it's something about the generated CSS file rather than the importing page. The consensus appears to be the Content-Type from the server may be wrong.

Harper Shelby
A: 

Your server procs (like the CGI) run first, don't they? Seems to me that that link tag will only pull in a file that exists already.

So what I'd do is put a server tag (my lang's ASP/ASP.Net, but you could use PHP or anything, really) in the href.

Like so:

<link rel="stylesheet" type="text/css href="<% =getStylesheetPath() %>" media="all">

Give that a shot.

John Dunagan