本文转载自https://github.com/Modernizr/Modernizr/wiki/HTML5-Cross-Browser-Polyfills,如果您需要获得最新更新,请阅读原文。
SVG
-
svgweb by brad neuberg & others
- fallback via Flash
-
Raphaël by dmitry baranovsky
- abstracted API. adds features. fallback for IE via VML.
- Ample SDK by Sergey ilinsky
-
canvg by Gabe Lerner
- writes SVG to canvas. Good for Android.
- SVG Boilerplate alpha and still buggy, but handle multiple concurrent SVG shims together
-
SIE SVG library by dhrname
- fallback to VML for oldIE
-
dojo gfx by Eugene Lazutkin, Kun Xi, Chris Mitchell
- fallback via VML, Canvas, Silverlight and Flash
-
fabric.js by kangax
- can render SVG via canvas.
- inline SVG polyfill by mstalfoort
SVG smil
Canvas
-
FlashCanvas by Shinya Muramatsu
- reported to have 33x better performance than excanvas.
- excanvas by google, erik arvidsson
- slcanvas project (Original Silverlight bridge, demo page)
- canvas-text only necessary for canvastext in IE, really
- fxCanvas
Web Storage (LocalStorage and SessionStorage)
- storage polyfill by remy sharp
- sessionstorage by andrea giammarchi
- Amplify.js by appendTo HTML5 API with fallbacks for HTML4 browsers (including IE6)
- realStorage HTML5 API is a subset of overall API
Non HTML5 API Solutions
- ssw
- lawnchair by brian leroux
- jStorage
- webstorage by ryan westphal
- store.js by marcus westin
- PersistJS by paul duncan
Sectioning Elements
-
html5shim by remy sharp, jon neal & community
- enables for print use, as well.
-
innerShiv by joe bartlett
- enables elements for innerhtml use
Video
-
mediaelement.js by john dyer
- swf player that mimics HTML5 media API. consistent UI across browsers and flash.
<track>
support
- swf player that mimics HTML5 media API. consistent UI across browsers and flash.
-
html5media
- uses flowplayer swf for fallback
-
video.js by Zencoder
- Device fixes.
<track>
support
- Device fixes.
-
playr
- includes
<track>
support
- includes
-
video for everybody by kroc camen (orig.)
- the granddaddy of
<video>
fallbacks. markup-based solution, works without javascript. a must read.
- the granddaddy of
VTT: Video Timed Track (subtitles)
- videosub
- JSCaptions by Daniel Davis
- Captionator by Christopher Giffard (Supports WHATWG TextTrack spec & has experimental support for MediaTracks/synchronised media elements)
Audio
- jPlayer custom player with jQuery dependency, flash fallback
- audio.js custom player, flash fallback by ab+c
- SoundManager2 custom player, flash fallback, api, extensive documentation
Web SQL Database
- clientdb.js requires gears. non-html5 api
- webstorageportabilitylayer requires gears. non-html5 api
- SQLjs requires gears. non-html5 api
- DomSQL non-html5 api
Web Forms
- Webshims Lib several Polyfills including Constraint Validation and several input-widgets by Alexander Farkas
- H5F by ryan seddon
- webforms2 by weston ruter
- h5Validate by Eric Hamilton
- nwx forms (demo) by Diego Perini
-
html5widgets by Zoltan Hawryluk
- uses webforms2 a few other battle-tested scripts for datepicker and colorpicker.
-
Accessible and unobtrusive slider /
<input type=range>
polyfill by Brian McAllister -
<input type=range>
shim for Firefox 4 by Frank Yan - jquery.html5form by Matias Mancini
- gallery-html5-forms YUI3 gallery module (HTML5-enable forms for legacy browsers; requires YUI3) by Matt Snider
- jquery.f5 Another bicycle for HTML5 forms. Implements most low-level features. by Alexander Dorofeev
Web Forms : input placeholder
- Placeholder Enhanced by Denis Ciccale
- Placeholder jQuery plugin by Mathias Bynens
- placeholder.js by NV. Both jQuery and pure JS versions (no longer maintained according to the author)
- jQuery-Placeholder by Daniel Stocks
- jquery html5 placeholder by miketaylr
- jquery-placeholder by Glenn Nilsson
- jquery.HTML5Support (supports placeholder and autofocus) by Amiel Martin
- placeholder by ajcates
Accessibility / ARIA
Web Workers
- (personally i can’t think of a good reason to use fake workers.. just sayin’)
- fakeworker
- web worker api shim
Web Sockets
- SockJS by Marek Majkowski
-
socket.io by guillermo rauch
- abstracts API and adds features
-
kaazing websocket gateway
- commercial product. pure polyfill.
-
web-socket-js
- supports CORS fallback
-
atmosphere jquery plugin
- fallback to comet long-polling
Geo-Location
- Webshims Lib has support for Geo location(among others) by Alexander Farkas
- geolocation shim by paul irish
-
geo-location-javascript
- mobile-centric: non-standard blackberry and webos tricks
- Geolocation-API-Polyfill by Manuel Bieh
Application Cache
- html5-gears by brad neuberg
Browser State Management
Offline & Online Events
- offline-event.js by Remy Sharp (Opera not supported, and Safari doesn’t update navigator.onLine property)
HTML5 History API (pushState, replaceState, popState)
- History.js (cross-compatibility between HTML5 browser implementations and optional hashchange fallback for HTML4 browsers) by Benjamin Lupton
- PJAX (pushState + ajax = pjax) by Chris Wanstrath
HTML4 Hashchange Event
- hashchange jQuery event by ben alman
- HistoryManager Mootools Plugin by arieh glazer
- SWFAddress (popular among Flash developers) & jQuery Address by Asual DZZD
- jQuery History Plugin by Benjamin Lupton
- jQuery Ajaxy by Benjamin Lupton
- Hasher by Miller Medeiros
EventSource
- EventSource by Remy Sharp
- jQuery.EventSource by rick waldron
- EventSource by Yaffle
Animated PNG (APNG)
- APNG-Canvas by Давид Мзареулян
-
png.js by Devon Govett
- Parses and renders PNGs both animated and static to a canvas element with putImageData
Ruby
- Cross-browser ruby annotations using CSS by Zoltan Hawryluk
- Here’s a basic CSS fallback
<details>
and <summary>
-
<details>
fallback via jQuery by Mathias Bynens -
Another
<details>
alternative, also based on jQuery by Manuel Bieh
<meter>
-
<meter>
fallback by strings28 -
<meter>
jQuery plugin/shim by xjamundx
Support for <output>
, <progress>
, <menu>
, <command>
, <keygen>
elements..
-
<progress>
polyfill by Lea Verou -
<menu type="context">
polyfill by Rodney Rehm
dataset
property (for use with custom data-*
attributes)
-
dataset
fallback by Eli Grey
<datalist>
- datalist fallback by adactio. Not a polyfill, but it’s done with PE.
- Webshims Lib has support for datalist-element (includes input[list], input[selectedOption], datalist[options]) by Alexander Farkas
File API / Drag and Drop
-
dropfile.js by Andrew Dodson
- Creates the FileReader part of the FileAPI via silverlight
-
jsDataView by vjeux
- DataView polyfill for structured data
- operaDragAndDrop.js Basic support for HTML5 Drag and Drop for Opera
-
FileSaver.js by eli grey
- incl BlobBuilder shim
Base64 (window.atob
and window.btoa
)
- David Chambers’
window.btoa
andwindow.atob
polyfill - base64 with concatenated strings support and some testing
Please also note that strings out of the ASCII range need an additional layer of encoding in JavaScript.
Device Access via <device>
- jQuery webcam plugin is not quite a polyfill but useful!
- also this webcam glue code might be a good start. w3c device spec
- No polyfills available yet for `ConnectionPeer`
WebGL
- jebgl uses a java applet to emulate.
- webgl-compat maps the API to 2D canvas
- cwebgl
MathML
(Web) Audio (Data) API
-
XAudioJS by Grant Galitz
- Audio sample stream output thin-abstraction library that supports mono and stereo audio, as well as resampling the audio stream.
- Supports the Mozilla Audio Data API, Web Audio API, Adobe Flash 10, real-time WAV PCM Data URI generation
- dynamicaudio.js by Ben Firshman
- audiolib.js by jussi kalliokoski
classList
- classList.js by Eli Grey.
- Minimal classList shim by Devon Govett.
Cross-Document/Domain Messaging (postMessage)
-
easyXDM by Sean Kinsey
- Implements XDM and RPC in most browsers since IE6. Also ships with an endpoint for exposing ajax across the domain boundary.
- postMessage jquery plugin by ben alman.
Cross-Origin Resource Sharing (CORS)
-
pmxdr by Eli Grey.
- Implements a cross-domain XHR. Note that sites being requested must have a pmxdr host.
-
flXHR by kyle simpson
- Provides XHR API using Flash transport mechanism. Target server must have a crossdomain.xml policy file.
DOM
- Flow implements DOM3 in IE6+
- DOM-shim implements DOM4 in IE8+
document.head
- url.js implements the W3C URL API, by Erik Arvidsson
DOM Range and Selection
-
Rangy by Tim Down.
- Implements DOM Range and Selection APIs in IE < 9.
DOM Parsing and Serialization
-
insertAdjacentHTML.js by Eli Grey
- Implements insertAdjacentHTML
-
outerHTML.js by Eli Grey
- Implements outerHTML
ECMAScript 5
- es5-shim by kris kowal, tom robinson, community.
-
Xccessors by Eli Grey.
- Implements ES5 accessors (getters and setters) for browsers supporting legacy methods and/or legacy methods for browsers supporting ES5.
-
getters and setters by the IE team.
- pick up get/set’ers for DOM elements in IE8
- json2.js by doug crockford
- ddr-ecma5 by David de Rosier
- augment.js by Oliver Nightingale
CSS3 Selectors
- selectivizr by Keith Clark
CSS3 Transforms
- Transformie by Paul Bakaus
- CSS Sandpaper by Zoltan Hawryluk
CSS3 Styles
-
cssFx – by Ivan Malopinsky
- Standalone, lightweight, client-side JS; supports almost all CSS3 properties
-
CSS Crush
- A PHP based CSS pre-processor for handling vendor prefixes, CSS variables, data-uris and minification
-
CSS Agent by Keith Clark
- A ASP.Net based CSS pre-processor for handling vendor prefixes, CSS variables and minification
- jQuery Css3 Finalize by Han Lin Yap
-
CSS3 PIE by Jason Johnston
- CSS3 decoration rendering for IE 6-9. Supports: border-radius, box-shadow, multiple backgrounds, linear gradients, border-image
-
Flexie by doctyper
- Flexible box model. (flexbox) Supports: box-orient, box-align, box-direction, box-pack, box-flex, box-ordinal-group
- CSS Template Layout jQuery plug-in by Alexis Deveria
-
Scoped Styles by Simon Madine
- jQuery Plugin to enable the scoped attribute on style blocks so they only affect their parent element’s children.
-
CSS3 – Multi Column by Cédric Savarese
- supports: column-count, column-width, column-gap, column-rule
-
jQuery Text Shadow by heygrady
- text-shadow action via jQuery plugin API
-
jQuery Text Overflow plugin by Devon Govett, Andrew A. Kononykhin, Micky Hulse
- text-overflow via jQuery plugin API (for developing standard)
-
Regions.js by Robin Ricard
- css3-regions via jQuery plugin API (for developing standard)
CSS3 Media Queries
- css3-mediaqueries-js
-
Respond by Scott Jehl
- A fast & lightweight polyfill for min/max-width CSS3 Media Queries (for IE 6-8, and more)
-
matchMedia by Scott Jehl, Paul Irish, Nicholas Zakas
- A standardized way to check media query matching in script.
-
jQuery Media Helpers by Scott Jehl
- Some media query and cross-browser responsive design helpers, abstracted from jQuery Mobile
-
Adapt.js
- Selectively loads CSS files based on browser window size.
Microdata API
- microdatajs by Philip Jägenstedt
- Microdata-JS (Extending Element.prototype with IE7, IE8 support) by Egor Nikolaev
XBL
- xbl.js by sergey ilinsky
<link rel="prefetch|prerender" ...
-
jiagra by samy kamkar
- a psuedo-polyfill for preloading pages to browser cache
Flash without the plug-in… – Flash runtime written in JavaScript
-
Google Swiffy
- Converts binary Flash files (
SWF
) to HTML+JS. It supports only a subset of SWF 8 and ActionScript 2.0, and the output renders only in Webkit-Browsers (Safari, Chrome). - Free server-based service
- Converts binary Flash files (
-
Adobe Wallaby
- Converts source Flash files (
FLA
) to HTML+JS. - Free application for Mac OS and Windows
- Converts source Flash files (
-
Gordon
- Interprets binary Flash files (
SWF
). Plays only SWF1 files completely, as well as most of the SWF2 features. - An open source Flash runtime written in JavaScript.
- Interprets binary Flash files (
-
Smokescreen
- Interprets binary Flash files (
SWF
). Supports a sizable subset of Flash 8 animation capabilities, streaming sound, sound effects, some input, and basic ActionScript. - Not yet released. Development seems to have stalled, on 1st May 2010 they announced: »A beta version will be released soon.«
- Interprets binary Flash files (
Illustrator export to Canvas
-
Adobe Ai to Canvas Plug-in
- Converts source Illustrator files (
ai
) to HTML5 canvas and JS. - Free plug-in for Adobe Illustrator (Mac OS X and Windows).
- [BTW: you may also use the SVG export, natively supported by Illustrator]
- Converts source Illustrator files (
Visibility
- visibility.js by Evil Martians
-
visibly.js by Addy Osmani
- The HTML5 Page Visibility API allows you to determine whether your web page is visible to the user, is hidden in background tab or is prerendering. visibility.js deals with vendor-prefixes and provides a fallback for browsers without this API by assuming the page is always visible. However, this is a wrapper more than a polyfill.
Hyphenation
-
hyphenator by Mathias Nater
- CSS3 defines six properties and an at-rule that influence hyphenation. Native support (with prefixes): Safari 5.1, FF 6
-
hyphenator
is a JavaScript implementation with pattern files for many languages. - Modernizr test needed
Other
-
requestAnimationFrame
– normalizes therequestAnimationFrame
method across browsers and implements a JS fallback for browsers that don’t
Mixed!
- Webshims Lib several Polyfills using lightweight capability based loading concept (shiv, innershiv, canvas, forms, ES5, localStorage/sessionStorage, JSON, geolocation) by Alexander Farkas
- Assorted file formats decoding of several file formats done in javascript, documented on the excellent jswiki
- Polyfill.js Polyfills loaded dynamically based on need (list of available polyfills on the linked page) by James Brumond
Everything!
-
google chrome frame
- not exactly a feature shim, but.. well.. it’ll help. 🙂
-
ie7.js, ie8.js, ie9.js by Dean Edwards
- A JavaScript library to make MSIE behave like a modern browser. Many fixes including PNG transparency, CSS styles/selectors, rendering bug fixes, etc.