I have 5 different websites that all use the same privacy html page but depending on which site they accessed it from I want the email to change dynamically.

For example, lets say I access the privacy page from Site A and click the [email protected] to send an email I want that email to be sent to [email protected], if I access the same privacy page from Site B and click the same email I want it to send to [email protected].

Is something like this possible with just HTML and JavaScript?

Thanks!

2

There are 2 answers

2
Oliver Williams On BEST ANSWER
var l=window.location+'';
l=l.replace(/http(s*):\/\/(www\.)*/,'');
l=l.split('/')[0]; //get the domain
var mailto='privacy-'+l+'@example.com';
0
suvroc On

It is depend on your current architecture. If you generate this privacy html page, you can add parameter to this generator.

If you have static privacy html page, you can change this email address with JS

document.getElementById("#your_mail_link").href="mailto:[email protected]";