Are applets now deprecated? - html

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:

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.

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>

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.

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.

Related

Is 3.2.5.9 of the HTML5 W3 spec deprecated?

I recently received the following comment:
Are these custom attributes (dw-filter et al) going to be valid across all browsers? Goes against the data-* convention.
Arguably, now that angular is becoming more prevalent on the web it's fairly common to find something such as:
<a _ngcontent-c2 class="col-1-4" ng-reflect-router-link="/detail/13" href="/preview/cj9t4xj0v00113c5sw2c8s6w8/detail/13">
<div _ngcontent-c2 class="module">
<h4 _ngcontent-c2>Bombasto</h4>
</div>
</a>
The W3 HTML5 spec explicitly states that:
https://www.w3.org/TR/html5/dom.html#custom-data-attribute: A custom data attribute is an attribute in no namespace whose name starts with the string "data-"
Angular applications always fail w3 validation due to this, even though very simple arbitrary custom attributes (some-attr="1") still work in all HTML5 browsers without complaint / error.
Do websites (angular or not) which use such custom attributes really need to honor this part of the specification anymore?
ng- attributes are not part of the HTML specification. Therefore, they are invalid markup. Proper custom attributes should begin with data- as specified in the current HTML5 specification. Angular attributes do not do that and fail most, if not all validators.
Failing to follow web standards is a risk that has caused issues in the past and now. Should an attribute become popular with some other group, or even become a standard in the future, will cause problems for anyone trying to establish their own. For whatever reason, WHATWG or the W3C decide to make ng- an attribute for a security property, every Angular application ever made will face an uncertain future.
Not to mention adding confusion to the web as witnessed by this question.
Always, always write valid markup.
Commentary:
Why Angular intentionally violates HTML standards, I do not know. (Note: see the reply from #angular in the comments.) Unfortunately, I see articles online where developers say, "So what?", and that, to me, smacks of the days of Microsoft browsers before competition from Firefox and, then, Chrome from Google, the developers of Angular, which boasted of standards compliance.

Where is the official HTML 5 API?

For JavaScript it seems easy. If you want to know the API for the language itself just consult ES5. For a library such as jquery just check out www.api.jquery.com.
But for HTML 5, where is the go to place to look for the API for a specefic tag?
Suppose I want to know the interface for <video>
My guess is
https://developer.mozilla.org/en-US/
but this is from the perspective of a company - Mozilla. Is there a published API by those that release the specs?
Can we use <video> as an example?
Here is one useful site I found that states that it parses the different specefications:
http://html5index.org/
but it looks like is is just for the JS portion.
I found it using this google search:
https://www.google.com/?gws_rd=ssl#q=html5+api&spell=1
I have been using w3schools b.c. it has the best layout, but I've heard many on SO say not to use this.
If not, what is the go to resource?
There is no official HTML5 API, or official HTML5, so far. What people regard as “de facto standard” is one of the following:
W3C HTML5 CR, a Candidate Recommendation, which means that it is not expected to change substantially before it becomes W3C Recommendation (which is as official as things like this ever get), except that some features marked as being “at risk” may be removed due to lack of implementation.
W3C HTML 5.1 Nightly, an Editor’s Draft, a further development of W3C HTML5. As the name says, it may and will change daily.
WHATWG HTML Living Standard. Largely compatible with the W3C documents but with some minor and some major differences. Apparently never expected to become any more official than it is now: a mutable document maintained by Ian Hixie and his orchestra (the WHATWG group).
Note that even the most official of these, HTML5 CR, says: “This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.” In reality, it’s more stable and closer to a “standard” than this may suggest.
All the documents mentioned above are incomplete in the sense that they cite many documents, e.g. DOM specifications and drafts, leaving essential parts to be defined in them. And the cited documents may be very mutable and even sketchy. For example, WHATWG URL Living Standard is cited, instead of the Internet-standard on URLs (URIs), and instead of the various old DOM specs and drafts, new emerging documents are cited. Currently, HTML5 CR cites W3C DOM4 CR.
Here's the HTML standard. It sounds like that's what you're looking for.
http://www.whatwg.org/specs/web-apps/current-work/multipage/
For the <video> example, here's the interface:
http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#htmlvideoelement
Of course, a lot of the interesting things are in the HTMLMediaElement interface.
If you keep going into the super-interfaces, you'll find that it extends the Element interface, which is part of DOM.
http://dom.spec.whatwg.org/#interface-element
Another popular standard comes from the W3C:
http://www.w3.org/TR/html5/
Here are a list of differences provided by W3C:
http://www.w3.org/wiki/HTML/W3C-WHATWG-Differences
The W3C published its official Recommendation of HTML5 on 28 October 2014.
There you will find a complete reference for all HTML5 elements including the video element.

Is it wrong to use obsolete tags in HTML?

What's so wrong about using obsoleted or not-yet-implemented HTML tags? Doesn't using them improve the portablity to older browsers? For example, today while validating some HTML docs I got this two messages:
Warning: The language attribute on the script element is obsolete. You
can safely omit it.
Warning: The bdi element is not supported by browsers yet.
I use
<script language="javascript" type="text/javascript">
because in the case a user is using a very outdated browser (e.g. IE 5) that doesn't interpret the attribute type, it still works by interpreting the "obsolete" attribute language.
And
<bdi>
in the case a user is using a sufficiently updated browser which interprets it.
For all I know, if a browser doesn't "know" an attribute/element it just omits it so, is it okay to do this or I'm missing something?
Well, using obsolete tags is okay as long as it is not necessary for the page to work. I would avoid using things like <marquee>, but I see no reason why your script element is wrong. Your bdi tag, however, if possible I would avoid, as not all browsers can use it.
According to the W3C (draft) spec for HTML5, it's ok to use the language attribute on a tag as long as it follows a couple rules, which yours appear to. The spec is calling this "Warnings for obsolete but conforming features". So I wouldn't worry about that one too much.
http://dev.w3.org/html5/spec/Overview.html#warnings-for-obsolete-but-conforming-features
For other obsolete attributes, I've created a little bookmarklet that removes obsolete (in HTML5) attributes from a page so you can visually see what effect would take place if a browser ends up completely not supporting the attribute. Check it out here -> attrebuke

Is there an xhtml.xsd equivalent available for HTML5?

I am developing an appplication based on Mozilla XULRunner.
I am using the xhmtl1-strict.xsd provided by the W3C to fetch the attribute. Now the requirement came to add the <video> tag to my application, but my application is not supporting any HTML5 elements or attributes.
So, any suggestions?
HTML5 does not have a doctype definition or an XML schema definition. This is because, although it shares the same syntax as its predecessor HTML 4, HTML5 itself is neither based on SGML nor XML. It's a markup language in its own right.
If you are looking to implement a browser with HTML5 capabilities using Mozilla technologies, the latest version of the Gecko layout engine supports HTML5. Get the Gecko/XULRunner SDK here.
The packages at http://www.xmlmind.com/xmleditor/download.shtml contain a file addon/config/xhtml/xsd/5.0/xhtml5.xsd which seems to be licensed as open source .
There is an HTML5 DTD which is used in the XML Catalog of Komodo, which is an XULRunner application. It can also be used in Eclipse without being converted to an XSD. In addition, there are style sheet and regex based DTD2XSD converters available.
To validate XHTML5, use the schema from v.Nu.
For details, see:
https://github.com/unsoup/validator

What's the key difference between HTML 4 and HTML 5?

What are the key differences between HTML4 and HTML5 draft?
Please keep the answers related to changed syntax and added/removed html elements.
HTML5 has several goals which differentiate it from HTML4.
Consistency in Handling Malformed Documents
The primary one is consistent, defined error handling. As you know, HTML purposely supports 'tag soup', or the ability to write malformed code and have it corrected into a valid document. The problem is that the rules for doing this aren't written down anywhere. When a new browser vendor wants to enter the market, they just have to test malformed documents in various browsers (especially IE) and reverse-engineer their error handling. If they don't, then many pages won't display correctly (estimates place roughly 90% of pages on the net as being at least somewhat malformed).
So, HTML5 is attempting to discover and codify this error handling, so that browser developers can all standardize and greatly reduce the time and money required to display things consistently. As well, long in the future after HTML has died as a document format, historians may still want to read our documents, and having a completely defined parsing algorithm will greatly aid this.
Better Web Application Features
The secondary goal of HTML5 is to develop the ability of the browser to be an application platform, via HTML, CSS, and Javascript. Many elements have been added directly to the language that are currently (in HTML4) Flash or JS-based hacks, such as <canvas>, <video>, and <audio>. Useful things such as Local Storage (a js-accessible browser-built-in key-value database, for storing information beyond what cookies can hold), new input types such as date for which the browser can expose easy user interface (so that we don't have to use our js-based calendar date-pickers), and browser-supported form validation will make developing web applications much simpler for the developers, and make them much faster for the users (since many things will be supported natively, rather than hacked in via javascript).
Improved Element Semantics
There are many other smaller efforts taking place in HTML5, such as better-defined semantic roles for existing elements (<strong> and <em> now actually mean something different, and even <b> and <i> have vague semantics that should work well when parsing legacy documents) and adding new elements with useful semantics - <article>, <section>, <header>, <aside>, and <nav> should replace the majority of <div>s used on a web page, making your pages a bit more semantic, but more importantly, easier to read. No more painful scanning to see just what that random </div> is closing - instead you'll have an obvious </header>, or </article>, making the structure of your document much more intuitive.
From Wikipedia:
New parsing rules oriented towards flexible parsing and compatibility
New elements – section, video, progress, nav, meter, time, aside, canvas
New input attributes – dates and times, email, url
New attributes – ping, charset, async
Global attributes (that can be applied for every element) – id, tabindex, repeat
Deprecated elements dropped – center, font, strike
HTML5 introduces a number of APIs that help in creating Web applications. These can be used together with the new elements introduced for applications:
An API for playing of video and audio which can be used with the new video and audio elements.
An API that enables offline Web applications.
An API that allows a Web application to register itself for certain protocols or media types.
An editing API in combination with a new global contenteditable attribute.
A drag & drop API in combination with a draggable attribute.
An API that exposes the history and allows pages to add to it to prevent breaking the back button.
You'll want to check HTML5 Differences from HTML4: W3C Working Group Note 9 December 2014 for the complete differences. There are many new elements and element attributes. Some elements were removed and others have different semantic value than before.
There are also APIs defined, such as the use of canvas, to help build the next generation of web apps and make sure implementations are standardized.
You might be interested in this list of HTML5 elements and attributes.
Also, please note that it's "HTML 4", not "HTML4". Indeed, for HTML 5, both variants are used, but there is an important difference in meaning. HTML 5 refers to the name of the W3C specification, whereas "HTML5" is the document type of those HTML files with a text/html MIME type that follow this spec.
The same goes for XHTML 5 vs. XHTML5.
Now W3c provides an official difference on their site:
http://www.w3.org/TR/html5-diff/
HTML 5 invites you give add a lot of semantic value to your code. What's more, there are natives solution to embed multimedia content.
The rest is important, but it's more technical sugar that will save you from doing the same stuff with a client programming language.
In short it is much simple compared to html, the long doctype is removed and also center and font tag is removed.
I also answered this difference in my blog :
http://ravisinghblog.in/key-difference-between-html-and-html-5/