-
-
Notifications
You must be signed in to change notification settings - Fork 879
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide support of MSIE 11 msCrypto #107
Conversation
MSDN crypto docs state the opposite, that IE11 |
@@ -11,6 +11,9 @@ | |||
// returns 128-bits of randomness, since that's what's usually required | |||
var _rng; | |||
|
|||
// Allow for MSIE11 msCrypto | |||
var _crypto = _global.crypto || _global.msCrypto; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you reverse the order here? I see some reports that IE11 defines crypto
, which would render the above moot. I.e., instead do this:
var _crypto = _global.msCrypto || _global.crypto;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, but in the (very unlikely) case of both, or where someone else has defined crypto globally, do you prefer the non-standard name over the standard name?
I can say without any question that MSIE11 does not support "crypto" natively, but only supports msCrypto. (crypto was in MSIE10.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The MDN page you referenced recommends the order I proposed, as does this MS page:
https://msdn.microsoft.com/en-us/library/ie/dn265046%28v=vs.85%29.aspx
var crypto = window.crypto || window.msCrypto;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Crypto != crypto
msCrypto == crypto (for our purposes, here)
Provide support of MSIE 11 msCrypto
Thanks! |
MSIE 11 removed support for crypto, renaming their version as msCrypto.
This patch uses window.msCrypto if window.crypto is unavailable (or falls back to the uuid module's RNG).