👀 Live Preview
Structure of an <object> with archive (fallback content shows in modern browsers):
archive="lib1.jar lib2.jar"Fallback: Your browser does not support this embedded object.

The archive attribute in HTML is used with the <object> element to specify a space-separated list of URLs of archives containing resources relevant to the object. This attribute is now largely obsolete, but it can still be found in older codebases. Understanding its purpose and usage can be helpful when maintaining or updating legacy HTML documents.
JAR and ZIP files.
Where archive applies.
One archive file.
Space-separated list.
Set archive dynamically.
Obsolete but useful.
archive AttributeThe primary purpose of the archive attribute is to provide a list of URLs for archive files (like .zip or .jar files) that contain resources the object might need. This was particularly useful in the context of applets and other embedded objects that required additional resources bundled together.
Java applets and many embedded-object use cases are deprecated. You will rarely use archive in new projects, but it helps when reading older HTML.
Add archive to an <object> element with one or more space-separated archive URLs:
<object data="myApp.jar" type="application/java-archive" archive="lib1.jar lib2.jar">
<!-- Fallback content -->
</object><object> (and historically <applet>).<object> for unsupported browsers.The archive attribute accepts a space-separated list of URL values. Each URL should point to an archive file containing resources for the object.
archive="example1.jar" references one archive file.archive="example1.jar example2.jar" lists several archives separated by spaces.https:// addresses.<!-- Single archive -->
<object archive="example1.jar" ...></object>
<!-- Multiple archives -->
<object archive="lib1.jar lib2.jar" ...></object>| Use Case | archive Value | Notes |
|---|---|---|
| One library JAR | example1.jar | Single URL |
| Multiple libraries | lib1.jar lib2.jar | Space-separated |
| Main app + libs | data="myApp.jar" + archive="lib1.jar lib2.jar" | data is primary; archive is extra |
| Applicable element | <object> | Also on deprecated <applet> |
| Modern status | Obsolete | Legacy maintenance only |
| Element | Supported? | Notes |
|---|---|---|
<object> | Yes (legacy) | Primary element for archive |
<applet> | Yes (deprecated) | Removed from HTML5; do not use |
<img> | No | archive does not apply |
<embed> | No | Use object or modern APIs instead |
Single archive URL, multiple archives, a complete object example, and dynamic JavaScript.
Structure of an <object> with archive (fallback content shows in modern browsers):
archive="lib1.jar lib2.jar"Fallback: Your browser does not support this embedded object.
Specifies a single archive file:
<object data="example.jar" type="application/java-archive" archive="example1.jar">
<!-- Fallback content -->
</object>Specifies multiple archive files, separated by spaces:
<object data="example.jar" type="application/java-archive" archive="example1.jar example2.jar">
<!-- Fallback content -->
</object>Here’s a basic example of how the archive attribute is used in an HTML document:
<object data="myApp.jar" type="application/java-archive" archive="lib1.jar lib2.jar">
<!-- Fallback content for browsers that do not support the object element -->
Your browser does not support Java applets.
</object>In this example, the <object> element references an application archive (myApp.jar) and additional resource archives (lib1.jar and lib2.jar). The browser would load these together when Java applets were supported.
You can dynamically set or modify the archive attribute using JavaScript. This can be particularly useful when you need to update the resources for an object based on user interaction or other conditions. Here’s a brief example:
<object id="myObject" type="application/x-java-applet">
Your browser does not support Java applets.
</object>
<script>
document.getElementById("myObject").setAttribute("archive", "dynamicLib1.jar dynamicLib2.jar");
</script>In this script, the archive attribute is dynamically set to include dynamicLib1.jar and dynamicLib2.jar for an object element with the id myObject.
<object> when the embedded resource cannot load.One or more JAR/ZIP paths on the object element.
Plugin runtime fetches bundled resources (legacy behavior).
Success shows the applet; failure shows fallback HTML.
Today, prefer modern web APIs instead of archive-based embedding.
The archive attribute was used with Java applets and embedded objects. Modern browsers no longer run Java applets, so this attribute is effectively obsolete for new development.
Understanding archive helps when reading or migrating old HTML—not when building new sites.
Bottom line: Do not use archive in new projects. Replace legacy applets with standard HTML, CSS, and JavaScript.
archive when maintaining legacy HTML<object>archive in new HTML5 documentsThe archive attribute in HTML was designed to provide URLs of archive files containing resources for the <object> element. While it’s now considered obsolete, understanding its use can be important for maintaining and updating legacy HTML documents.
By utilizing JavaScript, you can also dynamically manage this attribute to adapt to changing resource requirements—though migrating away from applet-based embedding is the better long-term approach.
archiveBookmark these when you encounter legacy embedded objects.
JAR / ZIP files.
ValuesPrimary target.
ScopeMultiple URLs.
SyntaxsetAttribute()
DynamicLegacy only.
Status<object> element. It was also used on the deprecated <applet> element.archive="lib1.jar lib2.jar".element.setAttribute("archive", "file1.jar file2.jar") at runtime.data points to the primary object resource. archive lists additional supporting archive files.Practice the archive attribute with single, multiple, and dynamic examples in the Try It editor.
5 people found this page helpful