IE11 'Promise' is not defined

I know that IE11 is an old monster and nobody should use it but at the end of the day there are some people playing with it yet.

I’ve tried to call some scripts like
<script src="https://cdn.polyfill.io/v2/polyfill.min.js"></script>

before including the Babylon scripts but without luck.

Anyway shouldn’t Babylon manage this without any additional code?

Thank you in advance!

Promise is already handled by babylon.js:

Here is my minimal reproducible example:
http://www.motivacg.com/temporal/babylonbug/indexbug.html

(you’ll need internet explorer 11)

Gotcha! This is because of the Draco compressor which is using WebWorker (where the promise polyfill is not supported)

Let me ask @bghgary to see if we can disable webworkers for Draco decompression

That’s a bummer. I wonder if we can load our promise polyfill in the web worker. For now, you can disable Draco compression from running in a web worker by doing something like this:

BABYLON.DracoCompression.DefaultNumWorkers = 0;

unfortunately, after using DefaultNumWorkers = 0, now it triggers:

BJS - [09:37:38]: Unable to load from ./mesh.glb: /meshes/0/primitives/0: undefined

www.motivacg.com/temporal/babylonbug/indexbug2.html

I guess any polyfill with self reference instead of window will do (for example promise-polyfill/polyfill.js at master · taylorhakes/promise-polyfill · GitHub) .
Adding this kind of global object detection method (self->window->global) to the PromisePolyfill.Apply method (in BJS) will allow you to use this polyfill in webworkers as well (not tested, just a thought :slight_smile: )

1 Like

I was getting that error before I suggested the DefaultNumWorkers, so unless you added that before I posted the reply, then it’s probably unrelated.

See if the model is compressed, it does not work in IE11 browser · Issue #7987 · BabylonJS/Babylon.js · GitHub for the current status of IE11 support for Draco.

2 Likes

I just noticed this thread, it appears the fix that was done here broke all my code (possibly b/c of my poor coding skills :slight_smile:), I started another thread about it but it looks like the cdn/stable version of Babylon.js references the preview versions of these draco decoder files

We resolved the issue you were having in the other thread which seems to be a caching issue.

The support for Draco in IE11 is now ready.

3 Likes

I was actually having problems with clients not able to access using IE 11 so I appreciate this fix :slight_smile:

1 Like