Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Video poster Property

Video poster property

Video Object Reference The Video object

Example

Modify the image displayed when the current video data is invalid:

document

.

getElementById

(

"

myVideo

"

)

.

poster

=

"

/images/logo2.png

"

;

Try it »


Definition and Usage

The poster property is used to set or return the value of the video's poster attribute.

The poster property describes the image displayed while the video is loading or before the user clicks the play button. If this attribute is not included, the first frame of the video will be used instead.


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the poster property.

Note: Internet Explorer 8 and earlier IE versions do not support


Syntax

Return the poster property:

videoObject

.poster

Set the poster property:

videoObject

.poster=

URL

Attribute values

Value Description
URL Describes the URL of the image file.

Possible values:

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

    Technical Details

    Return Value: A string representing the URL of the preview image. Returns the actual URL including the protocol (http://)

    More examples

    Example

    Get the URL of the preview image:

    var

    x

    =

    document

    .

    getElementById

    (

    "

    myVideo

    "

    )

    .

    poster

    ;

    x

    The output is:

    http://www.runoob.com/images/logo.png

    Try it »


    Related pages

    HTML Reference Manual: HTML


    Video Object Reference The Video object