Save and restore view from localStorage