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));
© 2022 - 2024 — McMap. All rights reserved.