开发者

Separate Objects for IE and FF

开发者 https://www.devze.com 2023-01-23 15:07 出处:网络
I\'m trying to embed my java applet using the object tag in html. While trying to research how to accomplish this task I came across this SO post.

I'm trying to embed my java applet using the object tag in html. While trying to research how to accomplish this task I came across this SO post.

when trying to put the code into action on my page it looks a little something like this...

<object name="Battleship"
    width="750" 
    height="800"
    classid="java:ApplicationApplet.class"
    type="application/x-java-applet">
    <object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
        codebase="http://java.sun.com/update/1.5.0/jinstall-1_5_0-windows-i586.cab"
        height="800"
        width="750">
        <param name="code" value="ApplicationApplet" />
        Your browser is not Java enabled.
     </object>
</object>

However, when I run this it crashes IE, but is fine in FF. I'm curious if there's something I'm missing to distinguish that IE should run the inner object and FF and others the outer obj开发者_开发百科ect?

Thanks guys!


Yes the conditional comments

http://en.wikipedia.org/wiki/Conditional_comment

<!--[if !IE]> Firefox and others will use outer object -->
<object name="Battleship"
    width="750" 
    height="800"
    classid="java:ApplicationApplet.class"
    type="application/x-java-applet">
    <!--<![endif]-->
    <!-- MSIE (Microsoft Internet Explorer) will use inner object --> 
    <object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
        codebase="http://java.sun.com/update/1.5.0/jinstall-1_5_0-windows-i586.cab"
        height="800"
        width="750">
        <param name="code" value="ApplicationApplet" />
        Your browser is not Java enabled.
     </object>
<!--[if !IE]> close outer object -->
  </object>
  <!--<![endif]-->
0

精彩评论

暂无评论...
验证码 换一张
取 消