THE WORLD'S LARGEST WEB DEVELOPER SITE

Video poster Property

❮ Video Object

Example

Change the poster image of a video:

document.getElementById("myVideo").poster = "/images/w3schoolscomlogo.png";
Try it Yourself »

Definition and Usage

The poster property sets or returns the value of the poster attribute of a video.

The poster attribute specifies an image to be shown while the video is downloading, or until the user hits the play button. If this is not included, the first frame of the video will be used instead.


Browser Support

Property
poster Yes 9.0 Yes Yes Yes

Syntax

Return the poster property:

videoObject.poster

Set the poster property:

videoObject.poster = URL

Property Values

Value Description
URL Specifies the URL of the image file.

Possible values:

  • An absolute URL - points to another web site (like href="http://www.example.com/poster.jpg")
  • A relative URL - points to a file within a web site (like href="poster.jpg")


Technical Details

Return Value: A String, representing the URL of the poster image. Returns the entire URL, including the protocol (like http://)

More Examples

Example

Get the URL of the poster image:

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

The result of x will be:

https://www.w3schools.com/jsref/w3javascript.gif
Try it Yourself »

Related Pages

HTML reference: HTML <video> poster attribute


❮ Video Object