在FF中引入Dynamiclly生成的(不是静态文件)CSS?

时间:2022-02-14 01:14:34

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

是否有任何方法可以将CSS样式表拉入FireFox 2或3中,而不是静态文件?

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

Bellow是我们用来引入由CGI脚本动态生成的样式表的代码。

<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.

请注意,上面提到CSS的URL并不以.css结尾,而是以参数为结尾。

5 个解决方案

#1


5  

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

服务器的内容类型是否是提供的文件的正确类型?

Content-type: text/css

#2


3  

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

为什么这不起作用?仔细检查cgi脚本的响应头是否有

Content-Type: text/css

#3


3  

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

扩展名无关紧要,但您应确保内容类型为“text / css”。

#4


0  

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.

我过去做过同样的事情 - 前雇主的网站使用的链接标签与你的很相似,至少在FF2中工作正常(我刚检查过,但我在添加该链接时在FF中测试过)。如果它不起作用,我怀疑它是关于生成的CSS文件而不是导入页面。共识似乎是来自服务器的Content-Type可能是错误的。

#5


0  

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.

您的服务器procs(如CGI)先运行,不是吗?在我看来,该链接标记只会提取已存在的文件。

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.

所以我要做的是在href中放置一个服务器标签(我的lang的ASP / ASP.Net,但你可以使用PHP或其他任何东西)。

Like so:

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

Give that a shot.

试一试。

#1


5  

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

服务器的内容类型是否是提供的文件的正确类型?

Content-type: text/css

#2


3  

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

为什么这不起作用?仔细检查cgi脚本的响应头是否有

Content-Type: text/css

#3


3  

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

扩展名无关紧要,但您应确保内容类型为“text / css”。

#4


0  

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.

我过去做过同样的事情 - 前雇主的网站使用的链接标签与你的很相似,至少在FF2中工作正常(我刚检查过,但我在添加该链接时在FF中测试过)。如果它不起作用,我怀疑它是关于生成的CSS文件而不是导入页面。共识似乎是来自服务器的Content-Type可能是错误的。

#5


0  

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.

您的服务器procs(如CGI)先运行,不是吗?在我看来,该链接标记只会提取已存在的文件。

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.

所以我要做的是在href中放置一个服务器标签(我的lang的ASP / ASP.Net,但你可以使用PHP或其他任何东西)。

Like so:

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

Give that a shot.

试一试。