Check if local storage is enabled before using set method.