Link media attribute

Definition and usage

media Attribute settings or return link element of media type.

Media types are important for style information. For example, the styles for computers and mobile devices may differ.

See also:

HTML Reference Manual:HTML <link> media Attribute

HTML Reference Manual:HTML <link> Tag

Example

Example 1

Return the media type used by the link element:

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

Try it yourself

Example 2

Change the media type:

document.getElementById("myLink").media = "all";

Try it yourself

Syntax

Return the media attribute:

linkObject.media

Set the media attribute:

linkObject.media = device

Attribute value

Value Description
all Used for all devices. Default.
aural Used for speech synthesizers.
braille Used for braille tactile feedback devices.
embossed Used for embossed braille printers.
handheld Used for handheld devices.
print Used for printing pages and print preview.
projection Used for projectors or overhead transparencies.
screen Used for color computer screens.
speech Used for speech synthesizers.
tty Used for teletype printers.
tv Used for television-like devices.

Technical Details

Return Value: A string value representing a list of media types separated by commas.

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support Support Support Support Support