Embedding a Java applet and provide installation option if Java is missing
What is the most user- and standard friendly way to embed a Java applet in a HTML page?
Is there something similar to Flash's swfobject that will gracefully degrade if Java 开发者_开发问答is not installed on the user's machine and give the user the alternative to install Java.
You can use the applet tag
From http://java.sun.com/j2se/1.5.0/docs/guide/plugin/developer_guide/using_tags.html#applet
<applet code=Applet1.class width="200" height="200">
Your browser does not support the <code>applet</code> tag.
</applet>
The content of the tag will be shown if the applet can't be laoded
Hi just use the object tag. It's part of the HTML specification and works with most browsers.
The fallback with installation option is just writing some text in the tag.
Here is a usefull article on the subject:
http://depth-first.com/articles/2008/02/20/demystifying-java-applets-part-1-cross-browser-standards-compliant-pure-html-deployment-using-the-object-tag
Regards
精彩评论