Fix issue #3556: Consolidate link handling code

This is a fix for issue #3556. I added the link handling code to the new code that prevents the links to do the default behavior and removed every other handling code. I also updated all the links to use the href for the url.