Filling the HTML5 Gaps with  Polyfills & Shims
Microsoft Evangelist .net Magazine writer jQuery JS Library Project Team Member JavaScript & HTML5 fan boy Rey Bango
Understand the issues surrounding HTML5 use today Browser fragmentation Feature support levels Answer these questions: What is feature detection?  What’s a polyfill and shim? How will they help you leverage HTML5 & CSS3 today? My Goal
Solutions to the Issues My Goal
Newest versions of HTML & CSS Supported by all modern browsers IE9 Firefox Chrome Opera Safari Snazzy new logo for HTML5 HTML5 & CSS3
The Problem: Browser Support
Most non-modern browsers have trouble of some sort Non-modern Browsers (ref:  caniuse.com ) IE 6 - 8 Firefox 3.6 and below Safari 4.0 and below Chrome 7 Opera 10.x and below Even modern browsers have issues Varying levels of feature support across all major browsers Non-Modern Browsers
Browser Fragmentation
 
Varying Levels of Support Across browsers Across browser versions New versions released constantly Browser detection doesn’t work Fixes based on assumptions Full-time job tracking changes Fragmentation
Solutions?
Feature Detection
Act based on what browsers support, not their versions Check for the feature you want to use Check for a specific: Object Method Property  Behavior Dynamically load custom code to mimic missing features Detect for standards-based features first Browsers often support both standards and legacy Standards are your most stable ground to build upon Feature Detection
Why not check  for a browser?
Bad // If not IE then use addEventListener… if (navigator.userAgent.indexOf("MSIE") == -1) { window.addEventListener( “load”, popMessage, false ); } else if (window.attachEvent) { window.attachEvent( “onload”, popMessage); }
Demo Browser Detection
Good if (window.addEventListener) { window.addEventListener( “load”, popMessage, false ); } else if (window.attachEvent) { window.attachEvent( “onload”, popMessage); }
Demo Feature Detection
What Happens When Feature Detection Looks Like This…
Yuck! function(){ var  sheet, bool, head = docHead || docElement, style = document.createElement("style"), impl = document.implementation || { hasFeature: function() { return false; } }; style.type = 'text/css'; head.insertBefore(style, head.firstChild); sheet = style.sheet || style.styleSheet; var supportAtRule = impl.hasFeature('CSS2', '') ? function(rule) { if (!(sheet && rule)) return false; var result = false; try { sheet.insertRule(rule, 0); result = (/src/i).test(sheet.cssRules[0].cssText); sheet.deleteRule(sheet.cssRules.length - 1); } catch(e) { } return result; } : function(rule) { if (!(sheet && rule)) return false; sheet.cssText = rule; return sheet.cssText.length !== 0 && (/src/i).test(sheet.cssText) && sheet.cssText .replace(/\r+|\n+/g, '') .indexOf(rule.split(' ')[0]) === 0; }; bool = supportAtRule('@font-face { font-family: "font"; src: url(data:,); }'); head.removeChild(style); return bool; }; Even the monkey is freaked!
Best option in my opinion for this… Feature Detection
Best feature detection support Detects: All major HTML5 features All major CSS3 features Includes HTML5Shim for semantic tag support Widespread adoption Twitter, National Football League, Burger King, and many more… Constantly updated Shipping with ASP.NET MVC 3 Tools update
Test for  @font-face
You Can Do This function(){ var  sheet, bool, head = docHead || docElement, style = document.createElement("style"), impl = document.implementation || { hasFeature: function() { return false; } }; style.type = 'text/css'; head.insertBefore(style, head.firstChild); sheet = style.sheet || style.styleSheet; var supportAtRule = impl.hasFeature('CSS2', '') ? function(rule) { if (!(sheet && rule)) return false; var result = false; try { sheet.insertRule(rule, 0); result = (/src/i).test(sheet.cssRules[0].cssText); sheet.deleteRule(sheet.cssRules.length - 1); } catch(e) { } return result; } : function(rule) { if (!(sheet && rule)) return false; sheet.cssText = rule; return sheet.cssText.length !== 0 && (/src/i).test(sheet.cssText) && sheet.cssText .replace(/\r+|\n+/g, '') .indexOf(rule.split(' ')[0]) === 0; }; bool = supportAtRule('@font-face { font-family: "font"; src: url(data:,); }'); head.removeChild(style); return bool; };
 
Or…. if (Modernizr. fontface ){ … }
Demo
Polyfills & Shims
What are they? Typically JavaScript, HTML & CSS code What do they do? Provides the technology that you, the developer, expect the browser to provide  natively Provides support for missing features  When do you use them? Use them to fallback gracefully or mimic functionality Polyfills & Shims
 
Polyfill: Replicates the real, standard feature API You can develop for the future Shims Provides own API to a missing feature Doesn’t adhere to a specification but fills the gap Generally provides more features What’s the Difference?
Big List of Polyfills:  http://bit.ly/b5HV1x Some are good, some not so good Some frequently used Polyfills & Shims Polyfill: HTML5Shim - Semantic tag support Storage Polyfill - HTML5 localStorage H5F – Simulates new HTML5 form types Shims: Amplify Store – persistent client-side storage using localStorage, globalStorage, sessionStorage & userData easyXDM – Cross-domain messaging Polyfills & Shims
Considerations You need to vet the code Does it work as expected? Cross-browser? You may need to support it in the future Developer abandons work Do you have the skills to maintain it? API Consistency Will you need to rewrite your code later? Consider This
Polyfills & Shims
Semantic Tags
<div id=”nav”> <div id=”sidebar”> <div id=”article”> <div id=”footer”> <div id=”header”> HTML Tags
nav article section footer aside header New Tags Provide actual meaning to the markup!
<nav> <aside> <section> <article> <footer> <header> Semantic HTML Tags
Browser Support?
Non-modern browsers don’t recognize the new tags Internal stylesheets not updated You can’t style elements not recognized Recognition & Styling
Demo Semantic Tags
Degrading Gracefully
Video Tag
<object  type=&quot;application/x-silverlight-2&quot; width=&quot;640&quot; height=&quot;384&quot;> <param name=&quot;source&quot;  value=&quot;http://channel9.msdn.com/App_Themes/default/VideoPlayer10_01_1 8.xap&quot;></param> <param name=&quot;initParams&quot;  value=&quot;deferredLoad=true,duration=0,m=http://mysite.com/videos/big_buck_ bunny.mp4,autostart=true,autohide=true,showembed=true&quot;></param> <param name=&quot;background&quot; value=&quot;#00FFFFFF&quot;></param> <a href=&quot;http://go.microsoft.com/fwlink/?LinkID=124807&quot; style=&quot;text- decoration: none;&quot;> <img src=&quot;http://go.microsoft.com/fwlink/?LinkId=108181&quot; alt=&quot;Get  Microsoft Silverlight&quot; style=&quot;border-style: none&quot;/> </a> <param name=&quot;x-allowscriptaccess&quot; value=&quot;never&quot;></param> <param name=&quot;allowScriptAccess&quot; value=&quot;never&quot; /> <param name=&quot;wmode&quot; value=&quot;opaque&quot; /> </object>  Video Before
<video controls width=&quot;500&quot;> <source src=&quot;video.mp4“  t ype=&quot;video/mp4&quot;  /> </video> HTML5 Video
Codec Support Credit: Encoding.com
Fallbacks can be used to degrade gracefully for different codecs <video controls width=&quot;500&quot;> <source src=&quot;video.mp4&quot; t ype=&quot;video/mp4“  /> <source src=&quot;video.ogg&quot; t ype=&quot;video/ogg“  /> <source src=&quot;video.webm&quot; t ype=&quot;video/webm“  /> </video> Degrading Gracefully
Browser Support?
If HTML5 video is not supported, SilverLight or Flash video will load <video controls width=&quot;500&quot;> <source src=&quot;video.mp4&quot; t ype=&quot;video/mp4“  /> <source src=&quot;video.ogg&quot; t ype=&quot;video/ogg“  /> <source src=&quot;video.webm&quot; t ype=&quot;video/webm“  /> <object  type=&quot;application/x-silverlight-2&quot; width=&quot;640&quot; height=&quot;384&quot;> <param name=&quot;source&quot; value=&quot;/resources/VideoPlayer10_01_18.xap&quot;></param> <param name=&quot;initParams&quot; value=&quot;m=http://mysite.com/video.mp4,autostart=true,autohide=true></param> <param name=&quot;background&quot; value=&quot;#00FFFFFF&quot;></param> <param name=&quot;x-allowscriptaccess&quot; value=&quot;never&quot;></param> <param name=&quot;allowScriptAccess&quot; value=&quot;never&quot; /> <param name=&quot;wmode&quot; value=&quot;opaque&quot; /> </object>  </video> Degrading Gracefully
Demo Video Tag
Avoid browser detection Browsers change Varying levels of feature support across all major browsers Use feature detection Check for the feature you want to use Detect for standards first Use Modernizr – http://modernizr.com Cleaner code & they’ve done the work for you Polyfills and Shims Opt for code that mimics a standard API to avoid a rewrite Take Away
@reybango blog.reybango.com [email_address]

More Related Content

PDF
Progressive Enhancement
PPT
WordPress Standardized Loop API
PPT
Comparative Display Technologies
PPT
Enterprise Google Gadgets Integrated with Alfresco - Open Source ECM
PPT
AtlasCamp 2011 - Five Strategies to Accelerate Plugin Development
ODP
Don't sh** in the Pool
PDF
Using HTML5 sensibly
PDF
Multimedia on the web - HTML5 video and audio
Progressive Enhancement
WordPress Standardized Loop API
Comparative Display Technologies
Enterprise Google Gadgets Integrated with Alfresco - Open Source ECM
AtlasCamp 2011 - Five Strategies to Accelerate Plugin Development
Don't sh** in the Pool
Using HTML5 sensibly
Multimedia on the web - HTML5 video and audio

What's hot (20)

ODP
10 Things You're Not Doing [IBM Lotus Notes Domino Application Development]
PPTX
HTML5 Accessibility - Is it ready yet?
PPS
Flash Templates- Joomla!Days NL 2009 #jd09nl
PDF
Use Web Skills To Build Mobile Apps
PPT
PDF
Plugins at WordCamp Phoenix
PPT
Introduction to ASP.NET MVC
PPTX
HTML 5 & Accessibility
PDF
Frontend Performance: Illusions & browser rendering
PPTX
GTM Clowns, fun and hacks - Search Elite - May 2017 Gerry White
PDF
Web Accessibility for the 21st Century
PPT
Creating Yahoo Mobile Widgets
PPT
Making Your Site Look Great in IE7
PDF
Test ss 2
PDF
Appcelerator Titanium Kinetic practices part 1
PPTX
GermaniumWeb training for CXA2010
PPTX
PPTX
How Not To Code Flex Applications
KEY
jQTouch – Mobile Web Apps with HTML, CSS and JavaScript
PPT
WordCamp Detroit 2010 Wordpress Theme Hacks
10 Things You're Not Doing [IBM Lotus Notes Domino Application Development]
HTML5 Accessibility - Is it ready yet?
Flash Templates- Joomla!Days NL 2009 #jd09nl
Use Web Skills To Build Mobile Apps
Plugins at WordCamp Phoenix
Introduction to ASP.NET MVC
HTML 5 & Accessibility
Frontend Performance: Illusions & browser rendering
GTM Clowns, fun and hacks - Search Elite - May 2017 Gerry White
Web Accessibility for the 21st Century
Creating Yahoo Mobile Widgets
Making Your Site Look Great in IE7
Test ss 2
Appcelerator Titanium Kinetic practices part 1
GermaniumWeb training for CXA2010
How Not To Code Flex Applications
jQTouch – Mobile Web Apps with HTML, CSS and JavaScript
WordCamp Detroit 2010 Wordpress Theme Hacks
Ad

Viewers also liked (7)

PDF
Tom Preston Werner - Optimize for happiness
PDF
Scott Chacon - Cuento de tres árboles
PDF
Caridy patino - node-js
KEY
Jonathan snook - fake-it
PDF
Ravi Mynampaty - developing findability standards
PDF
T.Pollak y C.Yaconi - Prey
PPT
Abraham Barrera - dev-cross-mobile
Tom Preston Werner - Optimize for happiness
Scott Chacon - Cuento de tres árboles
Caridy patino - node-js
Jonathan snook - fake-it
Ravi Mynampaty - developing findability standards
T.Pollak y C.Yaconi - Prey
Abraham Barrera - dev-cross-mobile
Ad

Similar to Rey Bango - HTML5: polyfills and shims (20)

PPS
Flash templates for Joomla!
PPT
Internet Explorer 8 for Developers by Christian Thilmany
PPT
Ajax to the Moon
PPT
Building Web Hack Interfaces
PPTX
Accelerated Adoption: HTML5 and CSS3 for ASP.NET Developers
PPTX
HTML5 and CSS3 Techniques You Can Use Today
PPT
WordPress Development Confoo 2010
PPT
Even Faster Web Sites at jQuery Conference '09
PPT
Justmeans power point
PPT
Justmeans power point
PPT
Justmeans power point
PPT
Justmeans power point
PPT
Justmeans power point
PPT
Justmeans power point
PPT
Justmeans power point
PPT
Justmeans power point
KEY
Taking your Web App for a walk
PPTX
HTML5
PPT
JBUG 11 - Django-The Web Framework For Perfectionists With Deadlines
Flash templates for Joomla!
Internet Explorer 8 for Developers by Christian Thilmany
Ajax to the Moon
Building Web Hack Interfaces
Accelerated Adoption: HTML5 and CSS3 for ASP.NET Developers
HTML5 and CSS3 Techniques You Can Use Today
WordPress Development Confoo 2010
Even Faster Web Sites at jQuery Conference '09
Justmeans power point
Justmeans power point
Justmeans power point
Justmeans power point
Justmeans power point
Justmeans power point
Justmeans power point
Justmeans power point
Taking your Web App for a walk
HTML5
JBUG 11 - Django-The Web Framework For Perfectionists With Deadlines

More from StarTech Conference (12)

PDF
Mike hostetler - jQuery knowledge append to you
PDF
Luis Meijueiro - Open Data
KEY
Stephen Anderson - Como construimos e hicimos crecer una empresa de consultor...
PDF
Jano Gonzalez - jruby
PDF
Pedro Fuentes - star techconf
PDF
Robert Nyman - HTML5 apis where no man has gone before startechconf
PPTX
Markos calderon lecciones aprendidas del desarrollo de un sistema de web co...
KEY
Charles nutter star techconf 2011 - jvm languages
PDF
Eduardo Silva - monkey http-server everywhere
PDF
Stephanie Rewis - css-startech
KEY
Mark ramm To relate or not to relate
PDF
Greg rewis move-itsession
Mike hostetler - jQuery knowledge append to you
Luis Meijueiro - Open Data
Stephen Anderson - Como construimos e hicimos crecer una empresa de consultor...
Jano Gonzalez - jruby
Pedro Fuentes - star techconf
Robert Nyman - HTML5 apis where no man has gone before startechconf
Markos calderon lecciones aprendidas del desarrollo de un sistema de web co...
Charles nutter star techconf 2011 - jvm languages
Eduardo Silva - monkey http-server everywhere
Stephanie Rewis - css-startech
Mark ramm To relate or not to relate
Greg rewis move-itsession

Recently uploaded (20)

PDF
ELLIE29.pdfWETWETAWTAWETAETAETERTRTERTER
PPTX
From Curiosity to ROI — Cost-Benefit Analysis of Agentic Automation [3/6]
PDF
Internet of Things (IoT) – Definition, Types, and Uses
PDF
ment.tech-Siri Delay Opens AI Startup Opportunity in 2025.pdf
PDF
EIS-Webinar-Regulated-Industries-2025-08.pdf
PPTX
CRM(Customer Relationship Managmnet) Presentation
PPTX
Presentation - Principles of Instructional Design.pptx
PDF
Ebook - The Future of AI A Comprehensive Guide.pdf
PPTX
Strategic Picks — Prioritising the Right Agentic Use Cases [2/6]
PDF
The AI Revolution in Customer Service - 2025
PDF
Human Computer Interaction Miterm Lesson
PDF
substrate PowerPoint Presentation basic one
PDF
Secure Java Applications against Quantum Threats
PDF
Introduction to c language from lecture slides
PPTX
From XAI to XEE through Influence and Provenance.Controlling model fairness o...
PDF
Examining Bias in AI Generated News Content.pdf
PDF
“Introduction to Designing with AI Agents,” a Presentation from Amazon Web Se...
PDF
EGCB_Solar_Project_Presentation_and Finalcial Analysis.pdf
PDF
Slides World Game (s) Great Redesign Eco Economic Epochs.pdf
PPTX
Rise of the Digital Control Grid Zeee Media and Hope and Tivon FTWProject.com
ELLIE29.pdfWETWETAWTAWETAETAETERTRTERTER
From Curiosity to ROI — Cost-Benefit Analysis of Agentic Automation [3/6]
Internet of Things (IoT) – Definition, Types, and Uses
ment.tech-Siri Delay Opens AI Startup Opportunity in 2025.pdf
EIS-Webinar-Regulated-Industries-2025-08.pdf
CRM(Customer Relationship Managmnet) Presentation
Presentation - Principles of Instructional Design.pptx
Ebook - The Future of AI A Comprehensive Guide.pdf
Strategic Picks — Prioritising the Right Agentic Use Cases [2/6]
The AI Revolution in Customer Service - 2025
Human Computer Interaction Miterm Lesson
substrate PowerPoint Presentation basic one
Secure Java Applications against Quantum Threats
Introduction to c language from lecture slides
From XAI to XEE through Influence and Provenance.Controlling model fairness o...
Examining Bias in AI Generated News Content.pdf
“Introduction to Designing with AI Agents,” a Presentation from Amazon Web Se...
EGCB_Solar_Project_Presentation_and Finalcial Analysis.pdf
Slides World Game (s) Great Redesign Eco Economic Epochs.pdf
Rise of the Digital Control Grid Zeee Media and Hope and Tivon FTWProject.com

Rey Bango - HTML5: polyfills and shims

  • 1. Filling the HTML5 Gaps with Polyfills & Shims
  • 2. Microsoft Evangelist .net Magazine writer jQuery JS Library Project Team Member JavaScript & HTML5 fan boy Rey Bango
  • 3. Understand the issues surrounding HTML5 use today Browser fragmentation Feature support levels Answer these questions: What is feature detection? What’s a polyfill and shim? How will they help you leverage HTML5 & CSS3 today? My Goal
  • 4. Solutions to the Issues My Goal
  • 5. Newest versions of HTML & CSS Supported by all modern browsers IE9 Firefox Chrome Opera Safari Snazzy new logo for HTML5 HTML5 & CSS3
  • 7. Most non-modern browsers have trouble of some sort Non-modern Browsers (ref: caniuse.com ) IE 6 - 8 Firefox 3.6 and below Safari 4.0 and below Chrome 7 Opera 10.x and below Even modern browsers have issues Varying levels of feature support across all major browsers Non-Modern Browsers
  • 9.  
  • 10. Varying Levels of Support Across browsers Across browser versions New versions released constantly Browser detection doesn’t work Fixes based on assumptions Full-time job tracking changes Fragmentation
  • 13. Act based on what browsers support, not their versions Check for the feature you want to use Check for a specific: Object Method Property Behavior Dynamically load custom code to mimic missing features Detect for standards-based features first Browsers often support both standards and legacy Standards are your most stable ground to build upon Feature Detection
  • 14. Why not check for a browser?
  • 15. Bad // If not IE then use addEventListener… if (navigator.userAgent.indexOf(&quot;MSIE&quot;) == -1) { window.addEventListener( “load”, popMessage, false ); } else if (window.attachEvent) { window.attachEvent( “onload”, popMessage); }
  • 17. Good if (window.addEventListener) { window.addEventListener( “load”, popMessage, false ); } else if (window.attachEvent) { window.attachEvent( “onload”, popMessage); }
  • 19. What Happens When Feature Detection Looks Like This…
  • 20. Yuck! function(){ var sheet, bool, head = docHead || docElement, style = document.createElement(&quot;style&quot;), impl = document.implementation || { hasFeature: function() { return false; } }; style.type = 'text/css'; head.insertBefore(style, head.firstChild); sheet = style.sheet || style.styleSheet; var supportAtRule = impl.hasFeature('CSS2', '') ? function(rule) { if (!(sheet && rule)) return false; var result = false; try { sheet.insertRule(rule, 0); result = (/src/i).test(sheet.cssRules[0].cssText); sheet.deleteRule(sheet.cssRules.length - 1); } catch(e) { } return result; } : function(rule) { if (!(sheet && rule)) return false; sheet.cssText = rule; return sheet.cssText.length !== 0 && (/src/i).test(sheet.cssText) && sheet.cssText .replace(/\r+|\n+/g, '') .indexOf(rule.split(' ')[0]) === 0; }; bool = supportAtRule('@font-face { font-family: &quot;font&quot;; src: url(data:,); }'); head.removeChild(style); return bool; }; Even the monkey is freaked!
  • 21. Best option in my opinion for this… Feature Detection
  • 22. Best feature detection support Detects: All major HTML5 features All major CSS3 features Includes HTML5Shim for semantic tag support Widespread adoption Twitter, National Football League, Burger King, and many more… Constantly updated Shipping with ASP.NET MVC 3 Tools update
  • 23. Test for @font-face
  • 24. You Can Do This function(){ var sheet, bool, head = docHead || docElement, style = document.createElement(&quot;style&quot;), impl = document.implementation || { hasFeature: function() { return false; } }; style.type = 'text/css'; head.insertBefore(style, head.firstChild); sheet = style.sheet || style.styleSheet; var supportAtRule = impl.hasFeature('CSS2', '') ? function(rule) { if (!(sheet && rule)) return false; var result = false; try { sheet.insertRule(rule, 0); result = (/src/i).test(sheet.cssRules[0].cssText); sheet.deleteRule(sheet.cssRules.length - 1); } catch(e) { } return result; } : function(rule) { if (!(sheet && rule)) return false; sheet.cssText = rule; return sheet.cssText.length !== 0 && (/src/i).test(sheet.cssText) && sheet.cssText .replace(/\r+|\n+/g, '') .indexOf(rule.split(' ')[0]) === 0; }; bool = supportAtRule('@font-face { font-family: &quot;font&quot;; src: url(data:,); }'); head.removeChild(style); return bool; };
  • 25.  
  • 26. Or…. if (Modernizr. fontface ){ … }
  • 27. Demo
  • 29. What are they? Typically JavaScript, HTML & CSS code What do they do? Provides the technology that you, the developer, expect the browser to provide natively Provides support for missing features When do you use them? Use them to fallback gracefully or mimic functionality Polyfills & Shims
  • 30.  
  • 31. Polyfill: Replicates the real, standard feature API You can develop for the future Shims Provides own API to a missing feature Doesn’t adhere to a specification but fills the gap Generally provides more features What’s the Difference?
  • 32. Big List of Polyfills: http://bit.ly/b5HV1x Some are good, some not so good Some frequently used Polyfills & Shims Polyfill: HTML5Shim - Semantic tag support Storage Polyfill - HTML5 localStorage H5F – Simulates new HTML5 form types Shims: Amplify Store – persistent client-side storage using localStorage, globalStorage, sessionStorage & userData easyXDM – Cross-domain messaging Polyfills & Shims
  • 33. Considerations You need to vet the code Does it work as expected? Cross-browser? You may need to support it in the future Developer abandons work Do you have the skills to maintain it? API Consistency Will you need to rewrite your code later? Consider This
  • 36. <div id=”nav”> <div id=”sidebar”> <div id=”article”> <div id=”footer”> <div id=”header”> HTML Tags
  • 37. nav article section footer aside header New Tags Provide actual meaning to the markup!
  • 38. <nav> <aside> <section> <article> <footer> <header> Semantic HTML Tags
  • 40. Non-modern browsers don’t recognize the new tags Internal stylesheets not updated You can’t style elements not recognized Recognition & Styling
  • 44. <object type=&quot;application/x-silverlight-2&quot; width=&quot;640&quot; height=&quot;384&quot;> <param name=&quot;source&quot; value=&quot;http://channel9.msdn.com/App_Themes/default/VideoPlayer10_01_1 8.xap&quot;></param> <param name=&quot;initParams&quot; value=&quot;deferredLoad=true,duration=0,m=http://mysite.com/videos/big_buck_ bunny.mp4,autostart=true,autohide=true,showembed=true&quot;></param> <param name=&quot;background&quot; value=&quot;#00FFFFFF&quot;></param> <a href=&quot;http://go.microsoft.com/fwlink/?LinkID=124807&quot; style=&quot;text- decoration: none;&quot;> <img src=&quot;http://go.microsoft.com/fwlink/?LinkId=108181&quot; alt=&quot;Get Microsoft Silverlight&quot; style=&quot;border-style: none&quot;/> </a> <param name=&quot;x-allowscriptaccess&quot; value=&quot;never&quot;></param> <param name=&quot;allowScriptAccess&quot; value=&quot;never&quot; /> <param name=&quot;wmode&quot; value=&quot;opaque&quot; /> </object> Video Before
  • 45. <video controls width=&quot;500&quot;> <source src=&quot;video.mp4“ t ype=&quot;video/mp4&quot; /> </video> HTML5 Video
  • 46. Codec Support Credit: Encoding.com
  • 47. Fallbacks can be used to degrade gracefully for different codecs <video controls width=&quot;500&quot;> <source src=&quot;video.mp4&quot; t ype=&quot;video/mp4“ /> <source src=&quot;video.ogg&quot; t ype=&quot;video/ogg“ /> <source src=&quot;video.webm&quot; t ype=&quot;video/webm“ /> </video> Degrading Gracefully
  • 49. If HTML5 video is not supported, SilverLight or Flash video will load <video controls width=&quot;500&quot;> <source src=&quot;video.mp4&quot; t ype=&quot;video/mp4“ /> <source src=&quot;video.ogg&quot; t ype=&quot;video/ogg“ /> <source src=&quot;video.webm&quot; t ype=&quot;video/webm“ /> <object type=&quot;application/x-silverlight-2&quot; width=&quot;640&quot; height=&quot;384&quot;> <param name=&quot;source&quot; value=&quot;/resources/VideoPlayer10_01_18.xap&quot;></param> <param name=&quot;initParams&quot; value=&quot;m=http://mysite.com/video.mp4,autostart=true,autohide=true></param> <param name=&quot;background&quot; value=&quot;#00FFFFFF&quot;></param> <param name=&quot;x-allowscriptaccess&quot; value=&quot;never&quot;></param> <param name=&quot;allowScriptAccess&quot; value=&quot;never&quot; /> <param name=&quot;wmode&quot; value=&quot;opaque&quot; /> </object> </video> Degrading Gracefully
  • 51. Avoid browser detection Browsers change Varying levels of feature support across all major browsers Use feature detection Check for the feature you want to use Detect for standards first Use Modernizr – http://modernizr.com Cleaner code & they’ve done the work for you Polyfills and Shims Opt for code that mimics a standard API to avoid a rewrite Take Away

Editor's Notes

  • #4: How developers can start using HTML5 now
  • #5: How developers can start using HTML5 now
  • #8: How developers can start using HTML5 now
  • #10: How developers can start using HTML5 now
  • #11: How developers can start using HTML5 now
  • #14: How developers can start using HTML5 now
  • #16: How developers can start using HTML5 now
  • #18: How developers can start using HTML5 now
  • #21: How developers can start using HTML5 now
  • #22: How developers can start using HTML5 now
  • #23: How developers can start using HTML5 now
  • #25: How developers can start using HTML5 now
  • #26: How developers can start using HTML5 now
  • #27: How developers can start using HTML5 now
  • #30: How developers can start using HTML5 now
  • #32: How developers can start using HTML5 now
  • #33: How developers can start using HTML5 now
  • #34: How developers can start using HTML5 now
  • #38: How developers can start using HTML5 now
  • #52: How developers can start using HTML5 now