Prevent undefined error if the <a> does not have an href attribute.

This can occur if the clicked element is an `a` tag but the `href` attribute has not been set.