FHIR Chat · IE11 :-( · javascript

Stream: javascript

Topic: IE11 :-(


view this post on Zulip Grahame Grieve (May 15 2019 at 03:43):

this page:

view this post on Zulip Grahame Grieve (May 15 2019 at 03:43):

http://www.fhir.org/guides/registry/

view this post on Zulip Grahame Grieve (May 15 2019 at 03:43):

loads fine in Chrome, Firefox, and Safari. But IE11.... doesn't load.

view this post on Zulip Grahame Grieve (May 15 2019 at 03:43):

looks like it's because there's a 'syntax ' error:

view this post on Zulip Grahame Grieve (May 15 2019 at 03:43):

unction loadRegistry() {
  fetch(url)
    .then(res => res.json())
    .then((out) => {

view this post on Zulip Grahame Grieve (May 15 2019 at 03:44):

I don't know enough about js to know what's going on here... what do I to fix it?

view this post on Zulip Josh Mandel (May 15 2019 at 12:08):

Consider https://github.com/github/fetch

view this post on Zulip Robert Winterbottom (May 15 2019 at 13:00):

Yup, second what @Josh Mandel said. IE does not support fetch, so you either need the polyfill he linked or a different method for doing http requests

view this post on Zulip Grahame Grieve (May 21 2019 at 05:12):

so I'm getting to this and looking at the documentation - I don't have a clue how https://github.com/github/fetch can be a contributer to a solution to the problem - the HTML doco looks identical to what I'm doing. Presumably I need to do something.. but the doco says npm install.... so I don't know how that can be relevant

view this post on Zulip Grahame Grieve (May 21 2019 at 05:52):

no. I need help here. I keep thinking I've got this sorted out, and no...

view this post on Zulip Grahame Grieve (May 21 2019 at 05:53):

so I thought I had figured out how to use https://github.com/github/fetch, but I'm getting an error in IE11:

view this post on Zulip Grahame Grieve (May 21 2019 at 05:53):

SCRIPT5009: 'Promise' is undefined: fetch.umd.js (448,5)

view this post on Zulip Grahame Grieve (May 21 2019 at 05:54):

.. since I thought I was using fetch.umd.js specifically to get things working in IE, I'm stuck....

view this post on Zulip Robert Winterbottom (May 21 2019 at 12:48):

So the npm install bit is if you are using a bundler of some sort, like webpack, rollup, or parcel, to build your website. It will bundle it in and try to minify code for you. Loading it via a script tag should be fine, but it sounds like the polyfill is using promises, which is also not supported in IE11. If you want to use that polyfill, you will probably need another one for promises (https://github.com/taylorhakes/promise-polyfill). I think you can try adding the <script src="https://cdn.jsdelivr.net/npm/promise-polyfill@8/dist/polyfill.min.js"></script> to the head and it should get you closer. Welcome to the wonderful world of web development :)

view this post on Zulip Paul Lynch (May 21 2019 at 15:31):

The fetch documentation's installation section says, "As an alternative to using npm, you can obtain fetch.umd.js from the Releases section. The UMD distribution is compatible with AMD and CommonJS module loaders, as well as loading directly into a page via <script> tag." -- so you don't need npm or a bundler.

view this post on Zulip Grahame Grieve (May 21 2019 at 20:38):

thanks Paul, I found line eventually. which led me to the promise problem.

view this post on Zulip Grahame Grieve (May 21 2019 at 20:40):

btw, Chrome is impossible to deal with here- it will not reload the js... is that something I'm doing wrong?

view this post on Zulip Nathan Hall (May 21 2019 at 20:41):

Probably caching your file. command+shift+r on mac

view this post on Zulip Grahame Grieve (May 21 2019 at 20:43):

so other people are having the same problem - I fixed a bug in the js, but they're not getting my fix, even though it's posted. They have to clear their cache manually?

view this post on Zulip Grahame Grieve (May 21 2019 at 20:44):

@Robert Winterbottom that fixed it - thanks

view this post on Zulip David Hay (May 22 2019 at 22:38):

yes - I've hit that as well with clinFHIR...

view this post on Zulip Paul Lynch (May 23 2019 at 14:46):

Some build systems will append to the file names a hash code of the file contents for resource files (js, png, etc.) so that URLs for those resources change when the resources change, avoiding caching issues.


Last updated: Apr 12 2022 at 19:14 UTC