Navigation buttons

Is it possible to make a back button that will always return to the previous page with the same, single peice of code?

Cheers, J