开发者

How to send CSS to the client using HTTP response headers?

How to send a CSS file to the client using server he开发者_开发问答aders?


Your question is not very descriptive, but you are probably refering to this article which was recently posted online.

It really is not that hard: RFC5988 describes the LINK header, which allows you to send <link> elements through HTTP headers instead of including them in the HTML.

Like the example in the article, usage is similiar to this:

Link: <some-document.html>;rel=prefetch

...which would have the same effect as placing this in your HTML:

<link href="some-document.html" rel="prefetch"

When using a language like PHP, you would have to write a line of code similiar to this:

<?php header('Link: <demo.css>;rel=stylesheet'); 

PLEASE NOTE: only FireFox and Opera seem to support this header at the time of writing.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜