It's a bit unclear to me how unique this needs to be. Does it need to be unique across browser sessions, in particular? Or would starting from 0 each time the browser launches be reasonable?
Does it need to be unique across different browsers? Or would, e.g., Chrome and Firefox having the same document ID be OK?
Specifying anything rigorously here is probably not possible, but it'd be good to clarify the scope of uniqueness you're expecting. Or maybe you could just normatively require random UUIDs; that might sidestep all the trickiness.
It's a bit unclear to me how unique this needs to be. Does it need to be unique across browser sessions, in particular? Or would starting from 0 each time the browser launches be reasonable?
Does it need to be unique across different browsers? Or would, e.g., Chrome and Firefox having the same document ID be OK?
Specifying anything rigorously here is probably not possible, but it'd be good to clarify the scope of uniqueness you're expecting. Or maybe you could just normatively require random UUIDs; that might sidestep all the trickiness.