Analytics choices

Analytics is optional. If allowed, Google measures public pages, navigation, recognized acquisition sources and engagement, including tool and playground use. The site excludes entered code, search terms and form contents from its Analytics events. You can withdraw here. This choice does not change advertising consent.

Read about Analytics and your information.

<applet>

Deprecated in HTML5 specifications. Use <embed> or <object> instead.

⚠️ DEPRECATED

Quick Answer

What was the <applet> tag?

The <applet> tag was used in HTML4 to embed Java applets into web pages. It has been deprecated since HTML5 due to security concerns and the decline of browser plugin support. Use <embed> or <object> tags instead, or consider modern alternatives like JavaScript, Canvas, or WebAssembly.

Definition and Usage

⚠️ obsolete and non-conforming in modern HTML
The <applet> tag is obsolete and non-conforming in modern HTML. Use the <embed> or <object> tag instead.

The <applet> tag was used in HTML 4 to embed Java applets into an HTML document.

Java applets were small applications written in Java that could run in web browsers. However, due to security concerns and the decline of Java browser plugins, this technology is now obsolete.

Security Note: Java applets are no longer supported by modern browsers due to serious security vulnerabilities. Most browsers have completely removed Java plugin support.

Browser support and standards

Browser rendering and modern HTML conformance are different questions. Check the current element reference for the browsers and features your project needs; the older source version table is not a current compatibility guarantee.

Read the MDN element reference

Old Usage (HTML 4)

In HTML 4, the <applet> tag was used to embed Java applets:

Old HTML 4 Example (Don't Use)

<!-- HTML 4 - DEPRECATED -->
<applet code="MyApplet.class" width="300" height="200">
  Your browser does not support Java applets.
</applet>

Modern Alternatives

Instead of <applet>, use modern web technologies:

1. Use <embed> Tag

For embedding external content:

Example with <embed>

Unavailable or blocked: embedded content “document.pdf”. Provide inline styles and scripts, embedded images or the missing HTML context. External requests and browser dialogs stay blocked.

<!-- HTML5 - For PDF or other content -->
<embed src="document.pdf" type="application/pdf" width="600" height="400" />

2. Use <object> Tag

For embedding multimedia and external resources:

Example with <object>

Unavailable or blocked: embedded content “animation.swf”. Provide inline styles and scripts, embedded images or the missing HTML context. External requests and browser dialogs stay blocked.

<!-- HTML5 - For multimedia content -->
<object
  data="animation.swf"
  type="application/x-shockwave-flash"
  width="400"
  height="300"
>
  <p>Your browser does not support this content.</p>
</object>

3. Use <iframe> Tag

For embedding external HTML pages:

Example with <iframe>

Unavailable or blocked: embedded content “https://example.com/content”. Provide inline styles and scripts, embedded images or the missing HTML context. External requests and browser dialogs stay blocked.

<!-- HTML5 - For external pages -->
<iframe src="https://example.com/content" width="600" height="400">
  Your browser does not support iframes.
</iframe>

4. Use JavaScript and HTML5 Canvas

For interactive applications, use modern JavaScript:

Example with Canvas

<!-- HTML5 - Modern interactive content -->
<canvas id="myCanvas" width="400" height="300"></canvas>

<script>
  const canvas = document.getElementById('myCanvas');
  const ctx = canvas.getContext('2d');

  // Draw interactive content
  ctx.fillStyle = '#745af2';
  ctx.fillRect(50, 50, 100, 100);
</script>

5. Use WebAssembly

For high-performance applications (Java alternatives):

Example Concept

The snippet includes JavaScript inside its HTML. Unavailable or blocked: network request “app.wasm”. Provide inline styles and scripts, embedded images or the missing HTML context. External requests and browser dialogs stay blocked.

<!-- HTML5 - High-performance apps -->
<script>
  // Load WebAssembly module
  WebAssembly.instantiateStreaming(fetch('app.wasm'))
    .then(result => {
      // Use compiled WebAssembly code
      result.instance.exports.main();
    });
</script>

Why Was It Deprecated?

  • Security Vulnerabilities: Java browser plugins had numerous critical security flaws
  • Performance Issues: Java applets were slow and resource-intensive
  • Browser Support: Modern browsers removed Java plugin support entirely
  • Better Alternatives: HTML5, JavaScript, and WebAssembly provide superior solutions
  • Mobile Incompatibility: Java applets never worked on mobile devices
  • User Experience: Required users to install Java Runtime Environment

Migration Guide

✅ How to Migrate from Java Applets:
  1. Assess Functionality: Determine what your applet does
  2. Choose Technology:
    • Simple graphics: Use HTML5 Canvas or SVG
    • Interactive apps: Use JavaScript frameworks (React, Vue, etc.)
    • Complex calculations: Use WebAssembly
    • Forms and UI: Use modern HTML5 and CSS
  3. Rewrite Code: Convert Java logic to JavaScript or compile to WebAssembly
  4. Test Thoroughly: Ensure functionality works across all modern browsers
  5. Remove Applet Tags: Replace with modern HTML5 elements

Timeline of Java Applets

  • 1995: Java applets introduced by Sun Microsystems
  • 1996-2010: Peak usage for interactive web content
  • 2013: Major browsers begin dropping support
  • 2015: Chrome removes NPAPI support (required for Java)
  • 2017: Firefox ends support for Java plugins
  • 2018: Oracle announces end of Java browser plugin
  • 2020+: No modern browser supports Java applets

Try it Yourself

Modern Alternative Example

Here's an interactive example using modern HTML5 Canvas (no Java needed):

Blank canvas drawing area.

This animated box uses JavaScript and Canvas - much better than Java applets!

Related Tags

  • <embed>

    ✅ Use this for external content

  • <object>

    ✅ Use this for multimedia

  • <canvas>

    ✅ Use for graphics and animation