0

I've got a webapp running in fullscreen that interacts with a database via ajax.

Is there a way i can get a "signature" or "id" of a device to store for each device???

Basically I've got a "saved items" option, and they will be saved to a unique id. I cant use IP Address coz of multiple devices or if you use the 3G service. Any other ideas? (dont want user authentication).

Could I save an array in the manifest file and access that?

Thanks

owenmelbz
  • 6,180
  • 16
  • 63
  • 113
  • Please see http://stackoverflow.com/questions/1968323/get-iphone-id-in-web-app. However, even if you had a native 'empty shell' app with only a webview loading your website (as suggested in the link), you would need a way to generate a unique device identifier as Apple has recently (starting with iOS5) deprecated the old way of getting the device identifier (via ` [[UIDevice mainDevice] uniqueIdentifier]`). The official recommandation is to identify the user, and not the device. – Emmanuel Sys Nov 23 '11 at 20:01

1 Answers1

0

I solved this issue by using html5's local storage.

i used

var salt=Math.floor(Math.random()*10000); //makes random salt
var randomId=Math.floor(Math.random()*20000); //makes another random number
randomId = salt+(salt*randomId); //makes the id even more random to avoid dupes
localStorange.setItem('deviceId',randomId); //sets a local variable that can be accessed by localStorage.getItem('deviceId'); and cross-refrenced with a $.get from a database to load the saves.
$.post("saveDeviceId.php?id="+randomId); //saves the new id to the database

this is how i resolved it anyway, unless anybody has a more efficient way?

owenmelbz
  • 6,180
  • 16
  • 63
  • 113