The declare attribute was a boolean flag on <object>. In HTML 4 it meant: define this object (with an id) but do not instantiate it until something else referred to that declaration.
Authors paired it with data and type. The HTML Living Standard now lists declare as obsolete: repeat a complete <object> each time you need the resource.
Obsolete — do not use in new pages.
Modern browsers ignore declare. Study it for legacy markup and exams; ship embeds without this attribute.
Not Baseline · Not experimental.
It is a removed historical feature, not a new API. Prefer native media, <iframe>, or a normal <object> with data/type.
Syntax
HTML Syntax
syntax.html
<object declare id="name" data="url">…</object>
Boolean form: write declare alone (or historically declare="declare"). Always needed an id so later markup could refer to the declaration.
Values
Attribute Values
Boolean only — no other meaningful values:
Value
Description
Try it
declare (present)
Historical: declaration only — do not instantiate yet
Toggle declare on a demo <object>. Modern browsers still ignore the flag — this only shows the attribute in the DOM.
Obsolete attribute demo. Expect no change in loading behavior.
object
hasAttribute("declare") = true — ignored by modern browsers
Code
HTML Examples
Historical patterns for study, plus a modern replacement. Use Try It Yourself for a live editor.
Example 1 — HTML 4 Style Declaration
Declare with an id, then refer later (historical pattern from HTML 4).
HTML
<!-- Historical only — browsers ignore declare today -->
<object
declare
id="earth.declaration"
data="earth.mpeg"
type="application/mpeg">
The <strong>Earth</strong> as seen from space.
</object>
<p>
<a href="#earth.declaration">View the Earth</a>
</p>
setAttribute("declare", "") adds the boolean attribute.
removeAttribute("declare") clears it.
hasAttribute reports presence in the DOM.
No loading change — useful only to inspect obsolete markup.
Example 3 — Modern Replacement
Omit declare. Repeat a full <object> when needed, or use native media with preload.
HTML
<!-- Correct today: no declare — repeat object if reused -->
<object data="poster.pdf" type="application/pdf" width="320" height="200">
<p>PDF preview unavailable. <a href="poster.pdf">Download the PDF</a>.</p>
</object>
<!-- Or control media loading with video + preload -->
<video controls preload="metadata" width="320">
<source src="clip.mp4" type="video/mp4">
Your browser does not support video.
</video>
Put useful HTML inside <object> for agents that cannot show the resource — that advice still applies without declare.
exams
Know it; do not ship it
Interview or certification questions may still mention declaration-only objects. Answer with “obsolete / ignored.”
Compatibility
Browser Support
declare was an HTML attribute on object. It is obsolete in the Living Standard and is not a modern browser feature to rely on.
✓ Obsolete · Ignored
declare
Listed as obsolete for object. Current Chrome, Firefox, Safari, and Edge do not implement declaration-only behavior. Safe conclusion: never depend on it.
0%Useful modern support
Google ChromeIgnored
Obsolete
Mozilla FirefoxIgnored
Obsolete
Apple SafariIgnored
Obsolete
Microsoft EdgeIgnored
Obsolete
OperaIgnored
Obsolete
Samsung InternetIgnored
Obsolete
Internet ExplorerLegacy partial
Legacy only
declareObsolete / ignored
Bottom line: Do not use declare in production. Repeat object elements or use video/audio/iframe and modern loading attributes instead.
Remember
Key Takeaways
History: boolean on <object> meaning “declare now, instantiate later.”
Status: obsolete in the HTML Living Standard — do not use.
Replacement: repeat a full <object>, or use native media / iframe.
Loading control: look at preload, defer, and async instead.
One line:declare is a legacy object flag — ignored today; omit it and use modern embeds.
Frequently Asked Questions
In HTML 4, declare on an object meant “define this object but do not instantiate it yet.” Later markup could refer to that declaration by id. Modern browsers ignore the attribute.
No. The HTML Living Standard lists declare on object as obsolete. Authors must not use it. Repeat a full object element whenever you need the resource again.
Only the object element. It was never a global attribute.
Yes. Presence alone turned on declaration-only mode. Values like declare="declare" or declare="true" were historical forms of the same boolean.
For embeds, use a normal object with data and type (or embed/iframe). For media loading, prefer video/audio with preload, or script with defer/async. Do not rely on declare.
No. They treat the object like any other object. Studying declare is useful for reading old docs and exams, not for new pages.