HTMLImageElement.longDesc - Web APIs 编辑

Obsolete

This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.

The obsolete 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.

Syntax

descURL = htmlImageElement.longDesc;
htmlImageElement.longDesc = descURL;

Value

A DOMString 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 obsolete 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:

<img src="taco-tuesday.jpg" 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:

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

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

Specifications

SpecificationStatusComment
HTML 4.01 Specification
The definition of 'HTMLImageElement.longDesc' in that specification.
RecommendationProvides an actual description of this property; the HTML5 spec only says it's deprecated.

Browser compatibility

BCD tables only load in the browser

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:110 次

字数:3657

最后编辑:7年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文