在 FF 中引入动态生成的(不是静态文件)CSS?
有什么方法可以将非静态文件的 CSS 样式表拉入 FireFox 2 或 3 中吗?
下面是我们用来拉入由 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
请注意,上面引入 CSS 的 URL 不是以 .css 结尾,而是以参数结尾做。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
服务器的内容类型对于所提供的文件来说是否正确?
Is the Content Type from the server the correct one for the file that is served up?
为什么这不起作用?
仔细检查 cgi 脚本的响应标头是否有
why isn't this working?
Double check that the response header for the cgi script has
扩展名并不重要,但您应该确保内容类型为“text/css”。
The extension doesn't matter but you should make sure the content type is "text/css".
我过去也做过同样的事情 - 前雇主的网站使用与您非常相似的链接标签,并且至少在 FF2 中工作得很好(我刚刚检查过它,尽管当我们添加该链接时我在 FF 中测试了它)。 如果它不起作用,我怀疑它与生成的 CSS 文件有关,而不是与导入页面有关。 共识似乎是来自服务器的内容类型可能是错误的。
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.
你的服务器进程(比如 CGI)首先运行,不是吗? 在我看来,该链接标记只会拉入已经存在的文件。
所以我要做的就是在 href 中放置一个服务器标签(我的 lang 的 ASP/ASP.Net,但你实际上可以使用 PHP 或任何东西)。
就像这样:
试一试。
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:
Give that a shot.