What is the shortest, accurate, and cross-browser compatible method for reading a cookie in JavaScript?
Very often, while building stand-alone scri
To truly remove as much bloat as possible, consider not using a wrapper function at all:
try { var myCookie = document.cookie.match('(^|;) *myCookie=([^;]*)')[2] } catch (_) { // handle missing cookie }
As long as you're familiar with RegEx, that code is reasonably clean and easy to read.