Non so dove hai letto che non bisogna mettere eventi nel html. Hai provato history.back()?