Link type 属性

定义和用法

type 属性设置或返回链接文档的内容类型(MIME 类型)。

提示:MIME 类型的示例有:"text/css", "text/javascript", "image/gif" 等。

另请参阅:

HTML 参考手册:HTML <link> ɗanin

HTML 参考手册:HTML <link> ɗanin

实例

返回链接文档的 MIME 类型:

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

亲自试一试

语法

返回 type 属性:

linkObject.type

设置 type 属性:

linkObject.type = MIME-type ɗanin

Attribute Value ɗanin

Value ɗanin Description ɗanin
MIME-type ɗanin
  • MIME type of the linked document.
  • Please see ɗanin IANA MIME Types ɗanin, to get a complete list of standard MIME types.

Technical Details ɗanin

Return value: ɗanin String value, representing the content type of the linked document.

Browser Support ɗanin

Chrome ɗanin Edge ɗanin Firefox ɗanin Safari ɗanin Opera ɗanin
Chrome ɗanin Edge ɗanin Firefox ɗanin Safari ɗanin Opera ɗanin
Support ɗanin Support ɗanin Support ɗanin Support ɗanin Support ɗanin