Hi, I am trying to create a website where the visitor can choose one of two languages when first arriving at the website. Then I want that choice to be saved throughout the whole visit without the visitor having to log in. I've always felt that cookies are a lame way of solving things so first I tried out always including the language choice in the url and making sure that the language choice always remained (if not the user switched it) through variables and php redirects if the choice was removed from the url. But it too felt unprofessional so I tried out storing the information in a session and it works perfectly except that I'm trying to create a script that deletes the session variable when the user leaves the site (onunload on the body doesn't work here because then it gets executed when the user wants to view another page of the site and not just when he leaves).
Maybe this is all unnecessary and I should just go with a cookie? Or does anyone have another solution?