[whatwg] <object> behavior

Michael A. Puls II shadow2531 at gmail.com
Fri Oct 16 03:10:35 PDT 2009


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>

-- 
Michael



More information about the whatwg mailing list