admin管理员组文章数量:1317909
have some troubles! For my requests i'm using Fetch API!
Submit form don't work in IE, because of "SCRIPT5009: 'fetch' is undefined"!
Example how it's looks like:
fetch("url", { method: "POST", body: JSON.stringify(data), headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' } }).then(function (response) { return response.json().then(function (data)
Same time in Chrome and FF it's works fine! I'm already trying to find some solutions surfing Google, but it was unhelpful!
I was tried to installing "isomorphic-fetch" and "es6-promise" in npm, and tried to import it in my .js file, but it was unsuccessful as well, console shows me this: "Uncaught SyntaxError: Unexpected token import"! Btw, required() function don't work as well! So I'm totally don't now what to do, how to use these polyfill thing and all of that!
If some ones have an idea, thanks in advance! BR!
have some troubles! For my requests i'm using Fetch API!
Submit form don't work in IE, because of "SCRIPT5009: 'fetch' is undefined"!
Example how it's looks like:
fetch("url", { method: "POST", body: JSON.stringify(data), headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' } }).then(function (response) { return response.json().then(function (data)
Same time in Chrome and FF it's works fine! I'm already trying to find some solutions surfing Google, but it was unhelpful!
I was tried to installing "isomorphic-fetch" and "es6-promise" in npm, and tried to import it in my .js file, but it was unsuccessful as well, console shows me this: "Uncaught SyntaxError: Unexpected token import"! Btw, required() function don't work as well! So I'm totally don't now what to do, how to use these polyfill thing and all of that!
If some ones have an idea, thanks in advance! BR!
Share Improve this question edited Mar 16, 2022 at 9:38 VLAZ 29.1k9 gold badges63 silver badges84 bronze badges asked May 29, 2017 at 12:03 Vadziec PoplavskyVadziec Poplavsky 7691 gold badge7 silver badges12 bronze badges 2-
1
It seems like
fetch
is not supported on IE. developer.mozilla/en/docs/Web/API/Fetch_API – Halcyon Commented May 29, 2017 at 12:04 - Yup, as I under stand its about native Fetch! But what about packages from npm like "isomorfic-fetch" or "fetch-wg", those are pofylfill! But its now work for me, but works for others! Magic! – Vadziec Poplavsky Commented May 29, 2017 at 12:09
1 Answer
Reset to default 8You can use https://github./github/fetch instead.
CDN: https://cdnjs./libraries/fetch
<script src="https://cdnjs.cloudflare./ajax/libs/fetch/2.0.3/fetch.js"></script>
If you need Promise
polyfill you can use http://bluebirdjs./docs/install.html
<script src="//cdn.jsdelivr/bluebird/3.5.0/bluebird.min.js"></script>
Load Bluebird
before fetch
:
<script src="//cdn.jsdelivr/bluebird/3.5.0/bluebird.min.js"></script>
<script src="https://cdnjs.cloudflare./ajax/libs/fetch/2.0.3/fetch.js"></script>
本文标签: javascriptSCRIPT5009 39fetch39 is undefinedStack Overflow
版权声明:本文标题:javascript - SCRIPT5009: 'fetch' is undefined - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742027790a2415878.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论