Iterating through FormData in IE

前端 未结 1 388
无人共我
无人共我 2020-12-06 11:07

I\'m using FormData to send information back to the server. In some cases however I need to read out the data before I send it.

Chrome allows you to iterate through

1条回答
  •  [愿得一人]
    2020-12-06 11:20

    There's a FormData polyfill that works. For details, read their docs.

    IE 10, IE 11 and Edge

    To make it work with IE 10 and above, you'll just have to add a WeakMap polyfill as well.

    JSBin demo for IE10 and above.

    
    
    
    

    Code above picks up the latest versions. Versions tested: https://unpkg.com/weakmap-polyfill@2.0.0/weakmap-polyfill.min.js and https://unpkg.com/formdata-polyfill@3.0.9/formdata.min.js


    IE11 and Edge, only (if you don't have to support IE10):

    If you only need IE 11 and above, you can remove the WeakMap's polyfill and just keep FormData's.

    JSBin demo here.

    
    
    

    Code above picks up the latest version. Version tested: https://unpkg.com/formdata-polyfill@3.0.9/formdata.min.js

    0 讨论(0)
提交回复
热议问题