Skip to content
Related Articles
Open in App
Not now

Related Articles

HTML DOM Link media Property

Improve Article
Save Article
  • Last Updated : 22 Aug, 2022
Improve Article
Save Article

The HTML DOM link media property is used to set or return the value of the media attribute of an <link> element. The media attribute is used to specify what type of media devices the target resource is optimized. 


It is used to return the media property.; 

It is used to set the media property."values" 

Property values:

  • all: Suitable for all devices
  • aural: Speech synthesizers
  • braille: Braille feedback devices
  • handheld: Handheld devices (small screen, limited bandwidth)
  • projection: Projectors
  • print: Print preview mode/printed pages
  • screen: Computer screens
  • tty: Teletypes and similar media using a fixed-pitch character grid
  • tv: Low resolution or limited scroll ability type devices like Television.

Return Value: It returns a String value which represents media types comma-separated list.

Example: Below HTML code illustrates, how to return the link media property. 


<!DOCTYPE html>
    <link id="linkid" rel="stylesheet"
        type="text/css" href="" media="screen">
<body style="text-align:center;">
    <h2>DOM Link media Property</h2>
    <button onclick="btnclick()">Return</button>
    <p id="pid" style="font-size:25px;color:green;">
        function btnclick() {
            // return Link media Property
            var newVar = document
                "pid").innerHTML = newVar;


Supported Browsers:

  • Google Chrome 1
  • Edge 12
  • Internet Explorer 6
  • Firefox 1
  • Opera 12.1
  • Apple Safari 4

My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!