HTML oncanplaythrough Attribute

❮ HTML Attributes


//Accessing the element
var vid = document.getElementById("myVideo");

//Creating a function
vid.oncanplaythrough = function() {
    alert("The video can play through without stopping");


The canplaythrough event run when the browser can play through the audio/video without stopping for buffering.

Standard Syntax

<element oncanplaythrough="script">

Browser Support


Applies to:

The oncanplaythrough attribute can be used on the following element:

Element Attribute
<audio> oncanplaythrough
<video> oncanplaythrough

Attribute Values

Value Description
script Specifies the script to be run on oncanplaythrough.
❮ HTML Attributes