How to get referral (inner) link

Hi there, here's my problem.
I have the whole site pages that might point in anymoment to a map
page where customer choose the country he belongs to.
I need to save the url they where before to enter into the map page.
something link "request.request_uri" but that works for the previous
page..
I thought I'd need something that acts like history.back(); with
javascript but I need to store that param in session..

how can I do that?!
thanks :wink:
Andrea