How do I check for FormData object using Modernizr and YepNope?
<script>
yepnope({
test : what.to.check,
yep : 'normal.js',
nope : 'flashupload.js'
});
</script>
I was looking for a Modernizer way to check FormData
the other day and couldn't find one.
However, it's easy to do without Modernizer:
window.FormData // exists if it exists, undefined if it doesn't!
So:
yepnope({
test : "FormData" in window,
yep : 'normal.js',
nope : 'flashupload.js'
});
FWIW, MDC compatability for FormData
says you'll be targeting:
... Opera support is unknown
You can extend Modernizr with custom tests. Just throw this into the end of your Modernizr file:
Modernizr.addTest('formdata', ('FormData' in window));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With