Path // www.yourhtmlsource.comReference → <applet>

<applet>


The <applet> element was used to embed Java applets into web pages. Java applets were small applications that ran in the browser using the Java Runtime Environment (JRE). This technology has been entirely deprecated due to security concerns and the rise of modern web technologies.

Clock This page was last updated on 2025-11-17



Deprecation Warning

This element is obsolete and should never be used. The <applet> element was deprecated in HTML 4.01 and removed from HTML5. More importantly, Java applet support has been removed from all modern browsers due to severe security vulnerabilities.

Java browser plugins were discontinued by Oracle in 2017, and no major browser supports them today. This makes <applet> not just deprecated in terms of standards, but completely non-functional in modern web browsers.

Syntax

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

The element required attributes to specify the Java class file, dimensions, and codebase. This syntax is now entirely obsolete.

Historical Context

Java applets were popular in the late 1990s and early 2000s for creating:

  • Interactive games
  • Financial calculators
  • Data visualizations
  • Scientific simulations
  • Educational applications

They fell out of favor due to:

  • Serious security vulnerabilities
  • Poor performance compared to native technologies
  • Need for plugin installation and updates
  • Incompatibility with mobile devices
  • Rise of JavaScript frameworks and HTML5 APIs

Modern Alternatives

All functionality that Java applets once provided can now be achieved with modern web technologies:

For Interactive Applications: JavaScript

<!-- Modern approach using JavaScript -->
<canvas id="myCanvas" width="300" height="200"></canvas>
<script src="app.js"></script>

For Games and Graphics: Canvas API

<canvas id="gameCanvas"></canvas>
<script>
  const ctx = document.getElementById('gameCanvas').getContext('2d');
  // Game logic here
</script>

For 3D Graphics: WebGL

<canvas id="webgl-canvas"></canvas>
<script src="three.js"></script>

For Data Visualization: SVG or Libraries

<!-- Using D3.js for data visualization -->
<div id="chart"></div>
<script src="d3.js"></script>

For Complex Applications: WebAssembly

WebAssembly allows running compiled code in the browser with near-native performance, making it suitable for computationally intensive applications.

When to Avoid

Always avoid using <applet>. There is absolutely no valid use case for this element:

  • It is completely non-functional in modern browsers
  • Java plugins are no longer available
  • It poses severe security risks if somehow enabled
  • It fails HTML5 validation
  • Modern alternatives are far superior in every way

If you encounter legacy <applet> elements in old code, they should be replaced with modern JavaScript-based solutions or removed entirely.

  • <object> - More generic element for embedding (still valid but rarely used for plugins)
  • <embed> - For embedding external content
  • <canvas> - Modern HTML5 element for graphics and interactivity
  • <script> - For including JavaScript code