function generateDeviceId() {
        var deviceId = "UNKNOWN";
        try {
            if ("undefined" === typeof localStorage) {
                throw new Error("device or platform does not support local storage");
            }
            if (window.localStorage.getItem("uuid") === null) {
                window.localStorage.setItem("uuid", randomUUID());
            }
            deviceId = window.localStorage.getItem("uuid");
        } catch (e) {
            deviceId = randomUUID();
            console.warn(e);
        } finally {
            return deviceId;
        }
    }
//Generate a device id, and attach it to localStorage.
Generate a device id, and attach it to localStorage.
Generate a device id and attach it to localStorage .
function generateDeviceId() {
        var deviceId = "UNKNOWN";
        try {
            if ("undefined" === typeof localStorage) {
                throw new Error("device or platform does not support local storage");
            }
            if (window.localStorage.getItem("uuid") === null) {
                window.localStorage.setItem("uuid", randomUUID());
            }
            deviceId = window.localStorage.getItem("uuid");
        } catch (e) {
            deviceId = randomUUID();
            console.warn(e);
        } finally {
            return deviceId;
        }
    }
function generateDeviceId ( ) { var deviceId = "UNKNOWN" ; try { if ( "undefined" === typeof localStorage ) { throw new Error ( "device or platform does not support local storage" ) ; } if ( window . localStorage . getItem ( "uuid" ) === null ) { window . localStorage . setItem ( "uuid" , randomUUID ( ) ) ; } deviceId = window . localStorage . getItem ( "uuid" ) ; } catch ( e ) { deviceId = randomUUID ( ) ; console . warn ( e ) ; } finally { return deviceId ; } }
Generate a device id, and attach it to localStorage.
Generate a device id and attach it to localStorage .