Use the onstalled attribute in HTML to execute the script when the browser cannot get the media date. The
onstalled attribute can be used on the following elements -<video> <audio>
-
The following is the syntax for-
ExampleYou can try running the following code to achieveonstalled Properties-
<!DOCTYPE HTML> <html> <body> <video width = "300" height = "200" controls onstalled ="display()"> <source src = "/html5/foo.ogg" type = "video/ogg" /> <source src = "/html5/foo.mp4" type = "video/mp4" /> Your browser does not support the video element. </video> <script> function display() { alert ("Sorry! Video isn't available right now!"); } </script> </body> </html>
The above is the detailed content of Execute script in HTML when browser cannot get media data for any reason?. For more information, please follow other related articles on the PHP Chinese website!