FetchAPI in a JavaScript function: The Fetch command is not recoqnized in a JavaScript function that I call with CallJS. What could be the reason for this and what can I do?
The CallJS command currently executes JavaScript via an internal Microsoft browser control object that restricts JavaScript to the Internet Explorer JavaScript level.
The Fetch API is part of the ECMAScript6 level, which Microsoft never implemented in IE.
You have three options:
A
Use the older XMLHttpRequest object instead of “Fetch”. It works with callback functions instead of “Promises”.
B
Use a “polyfill” for the Fetch API, e.g. https://github.com/JakeChampion/fetch
C
Use a hidden “WebView” object in your GuiXT script and call the JavaScript with connectHTML run=. The WebView supports ECMAScript6.
We plan to offer JavaScript calls with CallJS that support ECMAScript6 in the future.