Handle popstate events.