Home  >  Article  >  Web Front-end  >  Execute a script while the browser is fetching media data in HTML?

Execute a script while the browser is fetching media data in HTML?

WBOY
WBOYforward
2023-09-03 13:41:061037browse

Execute a script while the browser is fetching media data in HTML?

Use the onprogress attribute to execute the script while the browser is obtaining media data in HTML format.

Example

You can try running the following code to achieve onprogress Properties -

<!DOCTYPE html>
<html>
   <body>
      <video id = "myVideo" width = "320" height = "176" controls onprogress = "display()">
         <source src = "/html5/foo.ogg" type = "video/ogg" />
         <source src = "/html5/foo.mp4" type = "video/mp4" />
         Your browser does not support HTML5 video.
      </video>
      <script>
         function display() {
            alert("Started");
         }
      </script>
   </body>
</html>

The above is the detailed content of Execute a script while the browser is fetching media data in HTML?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete