Are applets now deprecated?
Asked Answered
A

4

10

I was reading through a website named w3schools and was taking the HTML5 lesson. There I saw a number of deprecated tags in HTML5 that were before accepted by HTML4. One of its tag were <applet>! So are now applets of no use?

You can see it here: HTML5 New Elements(at the end) or here: enter image description here

Arsphenamine answered 9/6, 2013 at 19:36 Comment(12)
I think some people are going to shout at w3schools now....Jacques
haha :D i think the same :PArsphenamine
@millimoose I already linked to that here though please note that it is generally unaccepted to just link-drop w3fools with no explanationTowland
@BenjaminGruenbaum Good point, sorry about that.Puto
Anyway, w3schools is being incomplete here. <applet> wasn't "removed", it's considered "obsolete and non-conforming". Such features are still part of the standard, they still have well-specified behaviour, but they trigger a validation error to use them since better alternatives exist.Puto
well, did I said "remove" here? I use the work "deprecated" which means "non-conforming"Arsphenamine
@AreebSiddiqui you have given applet in removed listJacques
man, it is what w3schools said but the things above in that page said that it is deprecatedArsphenamine
thanks!!! :) Such a dream...Arsphenamine
Why code an applet? If it is due due to spec. by teacher, please refer them to Why CS teachers should stop teaching Java applets.Hundred
It is now 2015; the w3schools guide for HTML has been updated to show HTML5 standards all throughout. I would think the site is still viable as good reference material.Spectrum
Even java 9 added @Deprecated(since="9") for the Applet class.Cis
F
14

Applets (as applications written in Java and intended to run inside a browser) are not deprecated in any way in HTML specifications or drafts. There is decreasing interest in them, due to many other alternatives being available, but that’s a different issue.

The applet element was declared deprecated in HTML 4, in favor of the object element. In HTML 4, deprecation means that element is still part of the language, browsers are recommended to support it (though in practice, not all browsers support it, and some browsers could not support it), but there is a recommendation to use something else (in this case, object) instead of it.

In HTML5 CR, the word “deprecated” is not used. It uses the term “obsolete”, which means in principle something quite different but comes very close in practice. In HTML5 CR, the applet element is declared “entirely obsolete and non-conforming”, with the note that it “must not be used by authors”. Yet, HTML5 contains a definition of applet under “Requirements for implementations”. And HTML5 conformance requirements specify that normal browsers must (not just should) support it.

One of the few real differences between the HTML 4 concept “deprecated” and the HTML5 concept “obsolete” is in validation: when validating against an HTML 4 DTD, applet is accepted when the Transitional DTD is used (but flagged as an error when validating against the Strict DTD); in HTML5 validation, applet is reported as an error.

P.S. W3schools should not be used as any kind of authority or reference, see http://w3fools.com


UPDATE 2021 - Applets were officially deprecated by Oracle in Java 9. So while W3Schools were not strictly correct at the time that this article was written, what they said then is correct ... now.

The main reason that Oracle gave for deprecating Applets was that most modern web browsers have stopped supporting them. As of right now, (AFAIK) only Internet Explorer still supports Applets, and IE is due to go EOL in mid 2022.

Forthwith answered 10/6, 2013 at 5:2 Comment(5)
What about Chrome which has stopped support for Applets?Lewert
While W3schools wasn't great, it's gotten better. W3fools is nothing more than an attempt to bring down w3schools and as far as I've seen, hasn't done anything to contribute a solution. Real developers contribute by providing constructive feedback about any reference material and work together to make something better.Spectrum
Neither I don´t know why i can't see an applet using Chrome?Urbanity
I suspect this answer may need to be updated because I went to Java.com with Edge and Chrome today (IE isn't even exposed in Windows 10 any more), and neither support Java applets any more.Aurelio
See also "Why were applets deprecated in JDK 9?" #45535612Polygyny
L
6

They are still of use, but use the object tag instead. Example:

<object
    width  = "800"
    height = "510"
    data   = "http://math.hawaii.edu/~ralph/Classes/Plotting/fplotter.jar"
    type   = "application/x-java-applet"
>
    <param
        name  = "codebase"
        value = "http://math.hawaii.edu/~ralph/Classes/Plotting/"
    />
    <param
        name  = "code"
        value = "a_fplotter.class"
    />
    <param
        name  = "width"
        value = "800"
    />
    <param
        name  = "height"
        value = "510"
    />
    <param
        name  = "archive"
        value = "fplotter.jar"
     />
</object>
Loathly answered 9/6, 2013 at 19:40 Comment(3)
"They are still in use" that's irrelevant. They're invalid.Towland
@BenjaminGruenbaum they are not invalid, they are "deprecated"Arsphenamine
I meant applets are still of use.Hagiocracy
B
4

Applet deprecated in Java 9

Applets are deprecated in Java 9. Oracle will stop distributing and supporting the Java browser plug-in.

Quoting from the java.applet.Applet class:

The Applet API is deprecated. See the java.applet package documentation for further information.

See this blog post from Oracle for more info: Moving to a Plugin-Free Web

Consider Java Web Start technology.

Besprent answered 28/2, 2017 at 11:19 Comment(0)
T
3

Disregarding whether or not applets are a good idea,

Use the <object> element instead. That's the standards complaint way.

The object element can represent an external resource, which, depending on the type of the resource, will either be treated as an image, as a nested browsing context, or as an external resource to be processed by a plugin.

Towland answered 9/6, 2013 at 19:41 Comment(3)
and what does that tag do by thw way?Arsphenamine
@AreebSiddiqui In the applet use case: The object tag does same thing that the applet tag did. If you're new to web-coding, I really think Java applets might not be the right place to start and w3schools might not be the right place to start learning. Consider starting with JavaScript, if you'd really like to keep using Java you can use GWT But I'd recommend against it if you're just starting.Towland
well, I am not a starter, I am an MS in exam 070-480 :)Arsphenamine

© 2022 - 2024 — McMap. All rights reserved.