Home > Article > Web Front-end > 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.
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!