W3cubDocs

/Web APIs

HTMLImageElement: longDesc property

Deprecated: This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.

The deprecated property longDesc on the HTMLImageElement interface specifies the URL of a text or HTML file which contains a long-form description of the image. This can be used to provide optional added details beyond the short description provided in the title attribute.

Value

A string which may be either an empty string (indicating that no long description is available) or the URL of a file containing a long form description of the image's contents.

For example, if the image is a PNG of a flowchart. The longDesc property could be used to provide an explanation of the flow of control represented by the chart, using only text. This can be used by readers both as an explanation, but also as a substitute for visually-impaired users.

Usage notes

This property is deprecated and should no longer be used. Instead of using longDesc to provide a link to a detailed description of an image, encapsulate the image within a link using the <a> element.

Consider the following older HTML:

html

<img
  src="taco-tuesday.jpg"
  alt="Taco Tuesday"
  longdesc="image-descriptions/taco-tuesday.html" />

Here, the longDesc is used to indicate that the user should be able to access a detailed description of the image taco-tuesday.jpg in the HTML file image-descriptions/taco-tuesday.html.

This can be easily converted into modern HTML:

html

<a href="image-descriptions/taco-tuesday.html">
  <img src="taco-tuesday.jpg" alt="Taco Tuesday" />
</a>

With that, the image is a link to the HTML file describing the image in more detail.

Specifications

This feature is not part of any current specification. It is no longer on track to become a standard.

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
longDesc 1 12 1 6 ≤12.1 3 4.4 18 4 ≤12.1 1 1.0

See also

© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/longDesc