1

I need to get rid or skip FormData.entries() in IE11. I have the code to check for IE 11 from here: https://stackoverflow.com/a/22242528/1824579

        var formData = new FormData();

        ...

        if (!navigator.appVersion.indexOf('Trident/') > -1) { //is 29 in IE; -1 in Chrome
            for (var pair of formData.entries()) { //error in IE11
                ...
            }
        }

So all I want to achieve is, that if the Browser is IE11 it should skip this section. By now I am not able to achieve this. In the console i only get this error shown up: SCRIPT1004: Expected ';' Index(1094, 31) which is exactly after the word pair in this line: for (var pair of formData.entries()) {

I don't know why IE11 is coming so far, because a log or the result of navigator.appVersion.indexOf('Trident/') is 29 in IE11.

manuzi1
  • 1,068
  • 8
  • 18

2 Answers2

2

for...of is not supported in IE11. This is a syntax-level issue that can't be solved by feature detection. Your best bet is to transpile your source code with something like Babel, targeting IE11.

Lionel Rowe
  • 5,164
  • 1
  • 14
  • 27
0

The issue might be with using the logical NOT operator. Checking "indexOf > -1" should do the trick or you may need to use an extra set of brackets:

if (!(navigator.appVersion.indexOf('Trident/') > -1))
Manuel Cheța
  • 480
  • 2
  • 10