html tutorial - oncanplaythrough Attribute in HTML - html5 - html code - html form




Oncanplaythrough attribute in html

Learn html - html tutorial - Oncanplaythrough attribute in html - html examples - html programs

  • The oncanplaythrough event happens when the web browser evaluates it can play through the specified audio/video without having to stop for buffering.
  • The oncanplaythrough attribute is section of the Event Attributes.

Syntax for oncanplaythrough attribute in HTML:

<element oncanplaythrough="Script">

Difference between HTML 4.01 and HTML 5 for oncanplaythrough Attribute:

HTML 4.01

HTML 5

Applies To:

Elements Attribute
<audio> oncanplaythrough
<video> oncanplaythrough

oncanplaythrough Attribute Values:

Value Description
script The script to be run on oncanplaythrough.

Sample Coding for oncanplaythrough Attribute in HTML:

Tryit<!DOCTYPE html>
<html>
    <head>
        <title>Wikitechy oncanplaythrough attribute</title>
    </head>
    <body>
    <video width="320" height="240" controls oncanplaythrough="onCanPlayThrough()">
        <source src="hibiscus.mp4" type="video/mp4">
    </video>
    <script>
        function onCanPlayThrough() {
            alert("Wikitechy Video Can be Played Fully!");
            }
    </script>
    </body>
</html>

Code Explanation for oncanplaythrough Attribute in HTML:

oncanplaythrough Attribute Code Explanation

  1. <video> tag is used to embed a video file in the HTML Document.
  2. The oncanplaythrough attribute is used to trigger an event when the video can be ready to play no need to buffer remaining frames.
  3. The JavaScript function onCanPlayThrough is used to display an alert message.

Output for oncanplaythrough Attribute in HTML:

oncanplaythrough Attribute Output

  1. The alert message shows when media file has been fully buffered.

Browser Support for oncanplaythrough Attribute in HTML:

Yes 9.0 Yes Yes Yes

Related Searches to oncanplaythrough Attribute in html

Adblocker detected! Please consider reading this notice.

We've detected that you are using AdBlock Plus or some other adblocking software which is preventing the page from fully loading.

We don't have any banner, Flash, animation, obnoxious sound, or popup ad. We do not implement these annoying types of ads!

We need money to operate the site, and almost all of it comes from our online advertising.

Please add wikitechy.com to your ad blocking whitelist or disable your adblocking software.

×