[whatwg] <object> behavior

Simon Pieters simonp at opera.com
Fri Oct 16 03:19:04 PDT 2009


On Fri, 16 Oct 2009 12:10:35 +0200, Michael A. Puls II  
<shadow2531 at gmail.com> wrote:

> On Fri, 16 Oct 2009 05:28:46 -0400, Ian Hickson <ian at hixie.ch> wrote:
>
>> There was also some discussion of what to do about preventing a plugin
>> instantiating. It seems to me that authors can do that by not creating  
>> the
>> <object> element ahead of time.
>
> And, if it's desired to specify the <object> via parsed markup (as  
> opposed to doing it all with JS), one can omit @type and @data so things  
> don't load and add them later like so:
>
> <object style="display: none"  
> data-load-on-demand-type="application/x-java-applet" id="test">
>      <param name="code" value="MyJavaClass">
>      fallback
> </object>
>
> <script>
>      window.onload = function() {
>          var obj = document.getElementById("test");
>          obj.style.display = "inline-block";
>          obj.type = obj.dataset["load-on-demand-type"];
>          alert("Come alive! Hide your fallback! I command you!");
>      };
> </script>

"One or both of the data and type attributes must be present." says the  
spec.

<embed> doesn't seem to have the same requirement for src and type. (Also  
compare with img, iframe, video...)

-- 
Simon Pieters
Opera Software


More information about the whatwg mailing list