Event when an anchor tag is refrenced.

Event when an anchor tag is refrenced.

I've spent a good time looking and have returned empty handed so I figured I would ask if anyone had come across this before.

I need to be able to fire an event when an anchor tag is referenced from the url. The complication here is that the anchor tag doesn't exist and there is no element triggering the event.

example:
when a user attaches text to the page url something like '#foo' the page will jump to the foo anchor tag. If no tag exists it jumps to the top of the page. I need to be able to catch that event and run a routine. The website is scaled to the height of the browser so I cant utilize the scroll events.

Thank you in advance,
John