Yes, the javascript is as follows:
echo "<script language='javascript'>";
echo "document.write('<a href='Javascript: history.go(-1)'>Back</a>')";
echo "</script>";
That was writen off the top of my head, so it might not work withought a few minor changes.