Video poster attribute

Definition and usage

poster Attribute sets or returns the value of the video poster attribute.

poster The attribute specifies the image to be displayed when the video is downloaded or before the user clicks the play button. If not set, the first frame of the video will be used.

Example

Example 1

Change the cover image of the video:

document.getElementById("myVideo").poster = "/images/w3logo.png";

Try it yourself

Example 1

Get the URL of the cover image:

var x = document.getElementById("myVideo").poster;

Try it yourself

Syntax

Return the poster attribute:

videoObject.poster

Set the poster attribute:

videoObject.poster = URL

Attribute value

Value Description
URL

Specifies the URL of the image file.

Possible values:

  • Absolute URL - Points to another website (e.g., href="http://www.example.com/poster.jpg")
  • Relative URL - points to a file within the website (such as href="poster.jpg").

Technical Details

Return Value: String value, representing the URL of the cover image. Returns the entire URL, including the protocol (such as http://).

Browser Support

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

Related Pages

HTML Reference Manual:HTML <video> poster Attribute