TAG: (or whatever string you want) tells the event that it is a variable, so get the content at the right, and return True. The advantage is that it does not change the title that may be displayed.
But I agree, it would be nice to have an event.
I looked for a previous feature request, but there was none. So I created one :
34768 - Javascript variable return in HTMLViewer