justaprogrammer/ObjectId.js — pull request #8 by cstigler (2014-08-11 21:05:37+00:00)
Title: Better stability / less waste when setting cookies

We noticed some undesired behavior with cookies when using ObjectId.js. This pull request has two commits that reduce cookie waste and fix a crash on Safari Private Mode (and other browsers with localStorage defined but disabled).

* Set one ObjectId cookie for an entire website instead of one per page, to be more true to the mongoMachineId name. We were previously getting one set per page on our site the user visited, which eventually resulted in a cookie string so long that pages were failing to load!
* Don't set a cookie if localStorage works
* If localStorage is defined but disabled, or Safari is in Private Mode, trying to set the value will throw a ```QuotaExceededError```, which currently is crashing the page. Instead, we should handle this case and use cookies instead.