All Projects → jimmywarting → Formdata

jimmywarting / Formdata

Licence: mit
HTML5 `FormData` polyfill for Browsers.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Formdata

Jquery Contextmenu
jQuery contextMenu plugin & polyfill
Stars: ✭ 2,148 (+635.62%)
Mutual labels:  polyfill, html5
Hyperform
Capture form validation back from the browser
Stars: ✭ 729 (+149.66%)
Mutual labels:  polyfill, html5
Loading Attribute Polyfill
Fast and lightweight dependency-free vanilla JavaScript polyfill for native lazy loading / the awesome loading='lazy'-attribute.
Stars: ✭ 335 (+14.73%)
Mutual labels:  polyfill, html5
Details Element Polyfill
<details>
Stars: ✭ 221 (-24.32%)
Mutual labels:  polyfill, html5
Theme Ad
🔨 Art design theme for write and show.
Stars: ✭ 262 (-10.27%)
Mutual labels:  html5
v8go-polyfills
Add polyfills to rogchap/v8go
Stars: ✭ 25 (-91.44%)
Mutual labels:  polyfill
Gapotchenko.FX
.NET polyfill to the future. A versatile RAD framework for .NET platform.
Stars: ✭ 23 (-92.12%)
Mutual labels:  polyfill
fromentries
Object.fromEntries() ponyfill (in 6 lines)
Stars: ✭ 62 (-78.77%)
Mutual labels:  polyfill
Flextable
table farming
Stars: ✭ 288 (-1.37%)
Mutual labels:  html5
Bootstrap Ie8
Bootstrap 4 for IE8 and IE9
Stars: ✭ 278 (-4.79%)
Mutual labels:  polyfill
Qmlcore
QML to Javascript/HTML5 translator, both for mobile and desktop targets
Stars: ✭ 258 (-11.64%)
Mutual labels:  html5
Get Me Through
A Free, Offline, Real-Time, Open-source web-app to assist organisers of any event in allowing only authorised/invited people using Face-Recognition Technology or QR Code.
Stars: ✭ 255 (-12.67%)
Mutual labels:  html5
Dynamic effect
平时练习的一些前端动效,基于HTML5,CSS3,Canvas,Svg
Stars: ✭ 264 (-9.59%)
Mutual labels:  html5
rangefix
Workaround for browser bugs in Range.prototype.getClientRects and Range.prototype.getBoundingClientRect.
Stars: ✭ 35 (-88.01%)
Mutual labels:  polyfill
Html Css
Curso de HTML5 e CSS3
Stars: ✭ 4,917 (+1583.9%)
Mutual labels:  html5
web-streams-polyfill
Web Streams, based on the WHATWG spec reference implementation
Stars: ✭ 198 (-32.19%)
Mutual labels:  polyfill
Front Ui
😄 🎨 Collect some front-end special effects (收集一些前端特效)
Stars: ✭ 259 (-11.3%)
Mutual labels:  html5
Saltgui
A web interface for managing SaltStack based infrastructure.
Stars: ✭ 278 (-4.79%)
Mutual labels:  html5
React Native Drawer Layout
A platform-agnostic drawer layout for react-native
Stars: ✭ 258 (-11.64%)
Mutual labels:  polyfill
Coreui Free Vue Admin Template
Open source admin template based on Bootstrap 5 and Vue 3
Stars: ✭ 2,951 (+910.62%)
Mutual labels:  html5

FormData

Greenkeeper badge

Build Status

npm version

JavaScript Style Guide

npm install formdata-polyfill

A FormData polyfill

This polyfill conditionally replaces the native implementation rather then fixing the missing functions, since otherwise there is no way to get or delete existing values in the FormData object. Therefore this also patches XMLHttpRequest.prototype.send and fetch to send the FormData as a blob, and navigator.sendBeacon to send native FormData.

I was unable to patch the Response/Request constructor so if you are constructing them with FormData you need to call fd._blob() manually.

new Request(url, {
  method: 'post',
  body: fd._blob ? fd._blob() : fd
})

Dependencies

If you need to support IE <= 9 then I recommend you to include eligrey's blob.js

Updating from 2.x to 3.x

Previously you had to import the polyfill and use that, since it didn't replace the global (existing) FormData implementation. But now it transparently calls _blob() for you when you are sending something with fetch or XHR, by way of monkey-patching the XMLHttpRequest.prototype.send and fetch functions.

So you maybe had something like this:

var FormData = require('formdata-polyfill')
var fd = new FormData(form)
xhr.send(fd._blob())

There is no longer anything exported from the module (though you of course still need to import it to install the polyfill), so you can now use the FormData object as normal:

require('formdata-polyfill')
var fd = new FormData(form)
xhr.send(fd)

Native Browser compatibility (as of 2020-01-13)

Based on this you can decide for yourself if you need this polyfill.

skarmavbild 2020-01-13 kl 20 16 36

This polyfill normalizes support for the FormData API:

  • append with filename
  • delete(), get(), getAll(), has(), set()
  • entries(), keys(), values(), and support for for...of
  • Available in web workers (just include the polyfill)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].