check href attribute before replace/return it