W3C home > Mailing lists > Public > public-html@w3.org > August 2007

<object> content-type sniffing (detailed review of Semantics)

From: Simon Pieters <simonp@opera.com>
Date: Thu, 23 Aug 2007 15:55:49 +0200
To: public-html <public-html@w3.org>
Message-ID: <op.tximbbihidj3kv@hp-a0a83fcd39d2.palace.opera.no>

(This is part of my detailed review of the Semantics and structure of HTML  
elements section.)

The spec says about <object>:

      4. Determine the resource type, as follows:

         Big Issue: This says to trust the type. Should we instead use
         the same mechanism as for browsing contexts?

I've done some ad-hoc testing. (See these test cases as demos -- I'm not  
entirely sure the pass conditions are actually according to the current  
spec...) It seems that some sniffing is happening in browsers.

gif as text/plain:

Safari treats the resource as application/octet-stream, and downloads it  
(then shows the fallback).

Firefox uses the fallback.

Opera shows the image.

IE7 treats the resource as text/plain if some security setting is enabled,  
but the infobar pops up and says that the content might not show up  
correctly. When clicking the infobar and choosing "show restricted  
content" it is treated as application/octet-stream, and a download dialog  

gif as text/html:

Abovementioned browsers treat it as HTML.

gif as image/png:
gif as image/jpeg:

It seems that image types are treated the same in browsers, and the  
resources are basically fed through the image library that reads the first  
few bytes before deciding what type of image it is. (This is also the case  
for browsing contexts, btw.)

flash as text/plain:
flash as text/plain with .swf extension:

It seems the file extension makes a difference in some browsers.

Safari treats the first as application/octet-stream (just like with 001)  
and the second as application/x-shockwave-flash.

Firefox treats both as text/plain.

Opera uses the fallback for the first and treats the second as  

IE7 treats the first as text/plain but shows the infobar (just like with  
001) and the second as application/x-shockwave-flash.

flash as application/octet-stream:
flash as application/octet-stream with .swf extension:

Safari, Opera and IE7 use the fallback for the first and treat the second  
as application/x-shockwave-flash.

Firefox uses the fallback for both.

flash as application/octet-stream, with type="":
flash as application/octet-stream with .swf extension, with type="":

Safari treats both as application/x-shockwave-flash.

Opera and Firefox use the fallback for the first and treats the second as  

IE7 doesn't seem to ever finish loading these...? But the Flash plugin is  
used for both nevertheless.

Note that not treating 010 as application/x-shockwave-flash caused  
problems for Mozilla:


Simon Pieters
Opera Software
Received on Thursday, 23 August 2007 13:55:56 UTC

This archive was generated by hypermail 2.3.1 : Thursday, 29 October 2015 10:15:25 UTC