Permalink
Browse files

add modernizr detection to lab

  • Loading branch information...
1 parent 87be522 commit 4df740757d026888816a3fdc1085578defc8e6fe @calvinf committed Jul 16, 2012
Showing with 30 additions and 8 deletions.
  1. +30 −8 labs/detection_modernizr.html
@@ -5,19 +5,41 @@
<script src="../javascript/modernizr-2.0.6.js"></script>
<script>
+ var log = function(stuff) {
+ if(console && console.log) {
+ console.log(stuff);
+ }
+ }
function check_offline() {
- }
+ log("offline mode (application cache): " + Modernizr.applicationcache);
+ }
- function check_placeholder() {
- }
+ function check_placeholder() {
+ log("placeholder support: " + Modernizr.input.placeholder);
+ }
- function check_video() {
- }
+ function check_video() {
+ log("html5 video support: " + Modernizr.video);
+ }
- function check_input_support() {
- }
+ function check_input_support() {
+ log("email input support: " + Modernizr.inputtypes.email);
+ }
function check_video_codec() {
+ var supported_video = "This browser supports: ";
+ if (Modernizr.video) {
+ if (Modernizr.video.webm) {
+ supported_video += "webm ";
+ }
+ if (Modernizr.video.ogg) {
+ supported_video += "ogg ";
+ }
+ if (Modernizr.video.h264){
+ supported_video += "h264 ";
+ }
+ }
+ log("Supported video: " + supported_video);
}
</script>
@@ -46,4 +68,4 @@
<br/>
</body>
-</html>
+</html>

0 comments on commit 4df7407

Please sign in to comment.