javaScript window.crypto.getRandomvalues is not working in safari browser -


can please me resolve issue. have used javascript window.crypto.getrandomvalues function working in browser expect safari web browser , safari browser version 5.1.7. please find code

    if ("crypto" in window && "getrandomvalues" in crypto)              rand = crypto.getrandomvalues(new uint8array(1))[0] % 16|0;         else rand = math.random() * 16 | 0;         return hexs[i === 19 ? rand & 0x3 | 0x8 : rand];     }) 

please find screenshot. error: [screenshot][1] http://i.stack.imgur.com/z1ayk.png

based on documentation here:

the array given parameter filled random numbers.

which not mean returns array filled random numbers. so, change code this:

if ("crypto" in window && "getrandomvalues" in crypto){   var arr = new uint8array(1);   crypto.getrandomvalues(arr)   rand = arr[0] % 16|0; } 

Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -