Crypto: randomUUID() method
The randomUUID()
method of the Crypto
interface is used to generate a v4 UUID using a cryptographically secure random number generator.
Syntax
Parameters
Return value
A string containing a randomly generated, 36 character long v4 UUID.
Examples
The method is accessed through the global crypto
property.
let uuid = self.crypto.randomUUID();
console.log(uuid);
Specifications
Browser compatibility
|
Desktop |
Mobile |
|
Chrome |
Edge |
Firefox |
Internet Explorer |
Opera |
Safari |
WebView Android |
Chrome Android |
Firefox for Android |
Opera Android |
Safari on IOS |
Samsung Internet |
randomUUID |
92 |
92 |
95 |
No |
78 |
15.4 |
92 |
92 |
95 |
65 |
15.4 |
16.0 |
See also