tags:

views:

70

answers:

5

My friend sent me a link to this little page which shows a simple HTML+CSS layed out page. However, if you look at the source code, you'll notice there's no link to the css file.

If you're using ff with firebug, you can see that under NET, the css file is linked through a sent header (just wanted to show y'all that).

My question is, do you have any assumption to as why this doesn't work with safari, ie? I assume that headers are not browser-dependent. What gives?

+3  A: 

You may find this a useful resource: http://www.w3.org/TR/html4/present/styles.html#h-14.6

Not sure why it doesn't work in Safari/Chrome (Webkit) but it could be because of this:

This section only applies to user agents conforming to versions of HTTP that define a Link header field. Note that HTTP 1.1 as defined by [RFC2616] does not include a Link header field (refer to section 19.6.3).

Brad
+1  A: 

This is part of the HTML spec, though isn't a standard part of HTTP 1.1. (RFC2616 doesn't define the Link field.)

Because of that, it's up to individual user agents to implement it. It's pretty obscure, and not very useful, so I guess that it isn't implemented in Webkit either due to unawareness, or deliberate intent to avoid obscure features.

Rich Bradshaw
It's not part of the HTML spec. It's part of the HTTP 1.0 RFC, with the explicit goal to provide resource linking for non-HTML resources. :-)
Franci Penov
A: 

http://www.w3.org/TR/html4/present/styles.html#h-14.6

14.6 Linking to style sheets with HTTP headers

This section only applies to user agents conforming to versions of HTTP that define a Link header field. Note that HTTP 1.1 as defined by [RFC2616] does not include a Link header field (refer to section 19.6.3).

So basically, this is not standard in http 1.1.

Lepidosteus
A bit off topic, but WebKit (erroneously?) 'allows' Javascript in its headers. See http://ha.ckers.org/weird/chrome-redirection.cgi and its headers, compare WebKit browsers with other ones...
Marcel Korpel
+1  A: 

The HTTP header it sends is Link: <style.css>; REL=stylesheet, which is equivalent to the HTML element <link rel="stylesheet" href="style.css" />.

It's an HTTP 1.0 only supported header. Added in RFC2068, 19.6.1.2 LINK, removed in RFC2616 (together with PATCH and UNLINK) due to lack of implementations.

Franci Penov
A: 

Mozilla actually has an MDC article titled Link prefectching that goes into almost everything you'd want to know about this and why they support it. Personally I think it sounds like a huge waste of time and bandwidth and just leaves a door open to browser attacks. Here's a quote that addresses your question directly:

Which browsers support link prefetching?

Browsers based on Mozilla 1.2 (or later) as well as browsers based on Mozilla 1.0.2 (or later) support prefetching. This includes Firefox and Netscape 7.01+. Camino builds as of March 2003 are based on Mozilla 1.0.1, and therefore do not support prefetching. Test your browser to see if it supports Link Prefetching.

Anthony