How to check for FormData using Modernizr and YesNope Javascript

javascript, modernizr, yepnope

Solution

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:

- Chrome 7+

- Firefox 4.0

- IE 10+

- Safari 5+

... Opera support is unknown

Problem

How do I check for FormData object using Modernizr and YepNope? ``` <script> yepnope({ test : what.to.check, yep : 'normal.js', nope : 'flashupload.js' }); </script> ```

Original source