Javascript DOM HTML Embed type Property get

Introduction

Return the MIME type of the embedded content:

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

Click the button to return the value of the type attribute of the embed element.

View in separate window

<!DOCTYPE html>
<html>
<body>

<embed id="myEmbed" src="video.mp4" type="video/mp4">
<button onclick="myFunction()">Test</button>

<p id="demo"></p>

<script>
function myFunction() {/* w  w  w. j a  v  a2s .  c  o  m*/
  var x = document.getElementById("myEmbed").type;
  document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

The type property sets or gets the value of the type attribute in an <embed> element.

The type attribute specifies the MIME type of the embedded content.

Property Values

Value Description
MIME_type The MIME type of the embedded content.

The type property returns a String representing the MIME type of the embedded content.




PreviousNext

Related