Comments: Learning w3c is to see a method to check whether your browser supports HTML5 videos. I would like to share with you here. If you are interested, please refer to it and hope to help you.
When learning html5 in http://www.w3school.com.cn, see a method to check whether your browser supports HTML5 video:
Running effect:
1. Run in EditPlus
2. Run in chrome
========================================================== ====================
Code Section:
========================================================== ====================
The Code is as follows:
<! Ductype html>
<Html>
<Script type = "text/javascript">
Function checkVideo ()
{
If (!! Document. createElement ('video'). canPlayType)
{
Var vidTest = document. createElement ("video ");
OggTest = vidTest. canPlayType ('video/ogg; codecs = "theora, vorbis "');
If (! OggTest)
{
Hsf-test = vidTest. canPlayType ('video/mp4; codecs = "avc1.42E01E, mp4a. 40.2 "');
If (! Hsf-test)
{
Document. getElementById ("checkVideoResult"). innerHTML = "Sorry. No video support ."
}
Else
{
If (hsf-test = "probably ")
{
Document. getElementById ("checkVideoResult"). innerHTML = "Yes! Full support! ";
}
Else
{
Document. getElementById ("checkVideoResult"). innerHTML = "Well. Some support .";
}
}
}
Else
{
If (oggTest = "probably ")
{
Document. getElementById ("checkVideoResult"). innerHTML = "Yes! Full support! ";
}
Else
{
Document. getElementById ("checkVideoResult"). innerHTML = "Well. Some support .";
}
}
}
Else
{
Document. getElementById ("checkVideoResult"). innerHTML = "Sorry. No video support ."
}
}
</Script>
<Body>
<P> check whether your browser supports HTML5 videos: </p>
<Div id = "checkVideoResult" style = "margin: 10px 0 0 0; border: 0; padding: 0;">
<Button onclick = "checkVideo ()" style = "font-family: Arial, Helvetica, sans-serif;"> Check </button>
</Div>
</Body>
</Html>