iOS WebApp -记住设备保存



我有一个web应用程序在全屏运行,通过ajax与数据库交互。

是否有一种方法,我可以得到一个"签名"或"id"的设备存储为每个设备?

基本上我有一个"保存项目"选项,他们将被保存到一个唯一的id。我不能使用IP地址,因为有多个设备,或者如果你使用3G服务。还有其他想法吗?(不需要用户认证).

我可以在manifest文件中保存一个数组并访问它吗?

谢谢

我使用html5的本地存储解决了这个问题。

我用

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

这就是我如何解决它,除非有人有更有效的方法?

最新更新