change button behavior by using history  api.