Tested this under Opera 9, Safari 3, Firefox 3 and IE 7.
All returned integer values, starting at 1 and then incrementing by 1 for each call to setTimeOut()
and setInterval()
. However, I noticed that the browsers started the counters and handled them differently:
- IE started with a (seemingly) random 6-digit number, but subsequent calls to either function incremented this number. After closing and reopening IE I found that the starting number appeared to be randomly generated, as it was nowhere near the count from the previous session.
- Opera maintained a counter for each tab - closing a tab and opening a new one started the counter from 1 in the new tab.
- In Safari, the count was global - opening a new tab and calling the functions in different tabs seemed to increment a global reference counter.
- In Firefox, the counter appeared to start at 2, and incremented on each subsequent call to either function. Like Opera, each tab had its own counter value, but they appeared to all start at 2.
Notice though, that in all the scenarios, no two identifiers (at least in the same tab) are the same.