target replacement: check against link.getAttribute('href') (unaltered) instead of link.href (which gets an absolute URL)