update the way to check if the window.localStorage supported or not