Shouldn't this detect if a link has target="_blank", because with this line the link will be opened in the same window.