A basic localStorage interface that defaults to cookies when localStorage is unavailable.