Javascript库可以可靠地加载Java Applets?

时间:2010-05-24 22:50:42

标签: java javascript applet

Flash用户拥有精彩的SwfObject JavaScript库,可以抽象浏览器差异,将swfs可靠地嵌入到他们的网页中。 Java Applets是否有这样的JavaScript库?

1 个答案:

答案 0 :(得分:5)

Oracle为此提供了deployJava.js。以下是从链接中复制的示例:

<script src="http://www.java.com/js/deployJava.js"></script>
<script>
    var attributes = {codebase:'http://java.sun.com/products/plugin/1.5.0/demos/jfc/Java2D',
                      code:'java2d.Java2DemoApplet.class',
                      archive:'Java2Demo.jar',
                      width:710, height:540} ;
    var parameters = {fontSize:16} ;
    var version = '1.6' ;
    deployJava.runApplet(attributes, parameters, version);
</script>