Skip to content
Related Articles

Related Articles

HTML DOM Link media Property

Improve Article
Save Article
Like Article
  • Last Updated : 30 Nov, 2021

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() {
            // Access link element.
            var newVar = document
                "pid").innerHTML = newVar;


Supported Browsers:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Opera
  • Apple Safari

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!