Link type attribute

Definition and Usage

type Set or return the content type (MIME type) of the linked document.

Tip:Examples of MIME types include: "text/css", "text/javascript", "image/gif", etc.

See also:

HTML Reference Manual:HTML <link> type 属性

HTML Reference Manual:HTML <link> 标签

Example

Return the MIME type of the linked document:

var x = document.getElementById("myLink").type;

Try it yourself

Syntax

Return type attribute:

linkObject.type

Set type attribute:

linkObject.type = MIME-type

属性值

描述
MIME-type
  • 链接文档的 MIME 类型。
  • 请查看 IANA MIME 类型,获取标准 MIME 类型的完整列表。

技术细节

返回值: 字符串值,表示链接文档的内容类型。

浏览器支持

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
支持 支持 支持 支持 支持