zahra_oveyedzade
zahra_oveyedzade

Reputation: 1220

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. 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?

Thank you.

Upvotes: 0

Views: 197

Answers (1)

mplungjan
mplungjan

Reputation: 178285

You can do this

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

Upvotes: 1

Related Questions