Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

407
Views
how to get unique id of every device in angular

Hi i am new to angular ... now i am trying to insert cart data in database table ... in my cart i want to store itemid,qty,deviceuniqueid ... why this deviceuniqueid means , in my webapp there is no login for user ...i want to show cart details in cart page .. thats only i need deviceuniqueid.... so how to get deviceuniqueid in angular... i search more but i can't find solution ...so please support me to develop webapp .. if any other new way to storedata in localstorage means help me to do this...thank you

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

There's no way you can get a device unique id from the browser; but you can generate one yourself upon startup and save it into localStorage for later re-use!

function generateUUIDV4(): string {
    // http://www.ietf.org/rfc/rfc4122.txt
    const s = []
    const hexDigits = '0123456789abcdef'
    for (let i = 0; i < 36; i++) {
      s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1)
    }
    s[14] = '4'  // bits 12-15 of the time_hi_and_version field to 0010
    // eslint-disable-next-line no-bitwise
    s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1)  // bits 6-7 of the clock_seq_hi_and_reserved to 01
    s[8] = s[13] = s[18] = s[23] = '-'

    const uuid = s.join('')
    return uuid
  }
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!