简体   繁体   English

如何在 html 的链接中嵌入源站地址?

[英]how embed origin site address in a link in html?

Assume there is a link like <a href="mysite.com">click here</a> in a footer of a website.假设在网站的页脚中有一个类似<a href="mysite.com">click here</a>的链接。 is there any way to change this link somehow that the admin of mysite.com website could detect from which site this user is coming from?有没有办法以某种方式更改此链接,以使 mysite.com 网站的管理员可以检测到该用户来自哪个站点?

Thank you.谢谢你。

You can do this你可以这样做

 <a href="https://example.com" onclick="this.href = 'https://example.com/?ref='+encodeURIComponent(location.host)">click here</a>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM