<embed>

Block for video, audio, and other content.

Time to read: less than 5 min

Briefly

A magic block for embedding content on the page in external formats that the browser displays using plugins. Most often used for video and audio content.

The display of the embedded content will depend on the attributes of the <embed> tag, the type of content loaded, and the plugins installed in the browser.

Example

        
          
          <embed src="sample.pdf" type="application/pdf">
          <embed src="sample.pdf" type="application/pdf">

        
        
          
        
      
Open demo in the new window

How to understand

The <embed> tag creates a kind of window in which the loaded content is displayed. Its behavior is somewhat similar to the tags <object> and <iframe>.

How it's written

The <embed> tag is a standalone tag, it does not need to be closed.

Attributes

  • src — link to the loaded content.
  • type — type of the loaded content in MIME format. Specifying the type is not required, but it is desirable. This way the browser will know exactly which plugin to use to display the content.
  • width — width in pixels.
  • height — height in pixels.

When specifying width and height, percentages are not allowed. Only a number is specified, without measurement units.

In addition to these attributes, any global attributes can be used.

Tips

💡 The <embed> tag is quite old. Some modern browsers have dropped support for it. It's better to use <object> instead.

💡 If the required plugin for displaying the content is not installed on the user's computer, they will see a warning message in the window:

        
          
          <embed src="player.swf" type="application/x-shockwave-flash">
          <embed src="player.swf" type="application/x-shockwave-flash">

        
        
          
        
      
Browser message "Plugin not supported"