Codice PHP:
document.write("<a href=\""+document.location.href+"\">"+document.location.href+"</a>");