detect and use localStorage