Use localStorage when available.