I have a line in my C# program which finds the name of the last control / button to be pressed:

and this string is used to go to a bookmark on a website. Eg. documentation.htm#ControlName

But what if the last button pressed isn't a bookmark in the html file? Can I find the button that was pressed before that, and before that?