optimize link creation, do not rely on document.location