stimulusreflex / stimulus_reflex

Build reactive applications with the Rails tooling you already know and love.
https://docs.stimulusreflex.com
MIT License
2.28k stars 172 forks source link

IE11 Support: "crypto" is undefined #308

Closed chooselife22 closed 4 years ago

chooselife22 commented 4 years ago

Bug Report

Window.crypto is undefined in Internet Explorer 11.

ReferenceError: "crypto" is undefined [object Object]

Describe the bug

https://github.com/hopsoft/stimulus_reflex/blob/691dca45eb6d119a467d3efeb4fac11e0e230321/javascript/utils.js#L7

from: https://developer.mozilla.org/en-US/docs/Web/API/Window/crypto

var cryptoObj = window.crypto || window.msCrypto; // for IE 11

is the possible fix.

something like the following would work image

Screenshots or reproduction

open your app with IE11

Versions

StimulusReflex

Browser

chooselife22 commented 4 years ago

any plans on supporting the ie11 crypto?

leastbad commented 4 years ago

Hi Andy, if this would make your life easier, please prepare a PR and I'll do my very best to get it included in the next major release (coming out on Tuesday). This seems pretty constrained and hopefully, harmless.

chooselife22 commented 4 years ago

Hi leastbad, i prepared the PR for this issue. I tested it locally and the msCrypto object is used now in IE11. So the uuid function ist working.