File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Applets and the fly likes HTML code to show applet? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "HTML code to show applet?" Watch "HTML code to show applet?" New topic
Author

HTML code to show applet?

Haina Minawa
Ranch Hand

Joined: Oct 13, 2011
Posts: 119
Hello, I am new to this forum and I have a question for you guys.
My question regarding the HTML to display a Java applet in browser:
- is <applet> tag deprecated and shouldn't be used any more, right?
- instead we should use <object> tag. I am wondering whether the <object> tag is cross browser or not? Do we need to write some javascript code to tackle for different browsers on different operating systems?

Because I have seen some javascript code like this:



Is the checking of browser and OS needed?

Thanks in advance.
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
I advise to use the <applet> tag and nothing else; <object> is outdated.

Alternatively, if you can require JavaScript, use the deployJava.js script: http://download.oracle.com/javase/6/docs/technotes/guides/jweb/deployment_advice.html#appletTagAttributes
Andrew Thompson
Ranch Hand

Joined: Aug 05, 2010
Posts: 77
    
    5
Use the deployJava.js to write the applet element. It takes care of the details, and is maintained by Oracle.


Andrew Thompson
http://pscode.org/
Haina Minawa
Ranch Hand

Joined: Oct 13, 2011
Posts: 119
Tim Moores wrote:I advise to use the <applet> tag and nothing else; <object> is outdated.


Thanks for your reply, but I think you are wrong, since <applet> tag is deprecated according to this. The <object> tag has come as a replacement.
Haina Minawa
Ranch Hand

Joined: Oct 13, 2011
Posts: 119
Andrew Thompson wrote:Use the deployJava.js to write the applet element. It takes care of the details, and is maintained by Oracle.


Thank you for the useful link
Andrew Thompson
Ranch Hand

Joined: Aug 05, 2010
Posts: 77
    
    5
Haina Soft wrote:
Andrew Thompson wrote:Use the deployJava.js to write the applet element. It takes care of the details, and is maintained by Oracle.


Thank you for the useful link


A good way to indicate usefulness is to click the '+1' button on the top of the post. ;)
Haina Minawa
Ranch Hand

Joined: Oct 13, 2011
Posts: 119
Andrew Thompson wrote:
A good way to indicate usefulness is to click the '+1' button on the top of the post. ;)


Fine. I gave you +1!
Haina Minawa
Ranch Hand

Joined: Oct 13, 2011
Posts: 119
Haina Soft wrote:

Thanks for your reply, but I think you are wrong, since <applet> tag is deprecated according to this. The <object> tag has come as a replacement.


Sorry, I correct my statement above: although the W3C states that the <applet> tag is deprecated, Oracle Sun still recommends developer to user it because the <object> tag is implemented inconsistently among browsers.
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
Further bit of advice: Don't ever trust w3schools.com, its content is as bad as roseindia.net.
Andrew Thompson
Ranch Hand

Joined: Aug 05, 2010
Posts: 77
    
    5
Tim Moores wrote:Further bit of advice: Don't ever trust w3schools.com, its content is as bad as roseindia.net.


Had to +1 that comment, but it has prompted me to jump back into the thread.

  • For information on HTML, I refer to the W3C site (quite distinct from W3Schools)
  • Here is the W3C mention of applet in HTML 4.01, note particularly: "APPLET is deprecated (with all its attributes) in favor of OBJECT." That was when HTML 4.01 was introduced (a long time ago).
  • Sun (now Oracle) can also generally not be trusted for advice on HTML, though they are right about the object element being inconsistently supported.
  • All the expertise Oracle has on deploying applets is invested in the deployJava.js that has now been mentioned by both of us that offered answers.

  • So why are we still discussing raw HTML?

    (Oh, and I still use the applet element for the applet viewer and simple tests, but for real World Wild Web deployment, it is deployJava.js all the way.)
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: HTML code to show applet?
     
    Similar Threads
    Need help getting applet to work in IE7
    Jsessionid JSP and applet
    Unable to load Applet in Tomcat 5.5.12
    get error Password Needed - Networking
    Unable to load Applet in Tomcat 5.5.12