what to do with invalid (or improper) mime-type resources

?I've been reading the spec around <link>, <script> and <object> tags, and specifically the wording about how the user-agent should not fetch a resource if the declared mime-type is something invalid (like "text/foobar").

I'm also trying to interpret the "spirit" of the spec with respect to how the user-agent should behave if it actually requests a resource (because let's say the author omits the `type` attribute on the container) and the container which receives it cannot validly process the type. For instance, if `new Image()` (in JavaScript) is used to fetch a URL, or if <object> does the same, and the resource that's returned is actually a script (or CSS file), it seems clear that the spec says the element should be ignored.

But I'm curious if that means (or *should* mean) that the resource is discarded/purged from the cache (if it was cached)? Or should that element be left alone in the cache? Some browsers are in the habit of "marking" such "ignored" resources with the invalid type, thus tainting that resource from being properly used with its correct type at a later time in the page life-time.

In other words, what is the full intent of "ignored"? Should the spec be clear about how such an element should be treated in the cache?

I ask because many different "loaders" (both CSS and JavaScript) attempt to use <object> and `new Image()` to "preload" (that is, load into cache, but not parse/execute) such content.

Is this a "safe" hack, or is it likely that such "preloading" will eventually (or is intended to be) prevented? 


--Kyle

Received on Saturday, 18 December 2010 00:19:32 UTC