Issue with script/mailto link

I’m using a little script/css solution to prevent spam and collection of email-addresses.

I am using the identical script on several websites.

Now, the funny thing is, that it works on one website (basically clicking the email-address will open a window in your favourite email application), while the others fail.

I noticed that the website where it works is running on roots 6.5.0 while the others are 6.5.1

website w. working script:
website w. failing script:

As for the latter, I only added this one script to the _main.js, so I suppose it can’t be a conflict.

Any ideas?

You should always be checking your dev tools console:

Uncaught ReferenceError: mailto is not defined

mailto isn’t even found in your scripts.min.js so that’s the problem. Not sure what exactly your workflow is. Are you using Grunt?

I’m using grunt on Windows with XAMPP for local development, as I use shared hosting which prevents me from shell access.

Anyway, this is the script that I use (in _main.js):
/*! Mask Email Address */ function mailto(host,name,tld) { window.location = 'mailto:'+name+'@'+host+'.'+tld; }

And this is the corresponding LESS/CSS Code:
/* Mask Email Address */ .e-addy { text-decoration: none !important; } .e-addy:hover { color: #333 !important; text-decoration: underline !important; } .e-addy .at, .e-addy .dot { display: none; text-decoration: none !important; } .e-addy .domain:before { content: "@"; } .e-addy .domain:after { content: "."; }

As I said, it works on Roots 6.5.0 not on 6.5.1

You need to run grunt after making changes to _main.js.

I know that I have to run grunt and that’s what I did. I’ve build several sites based on roots already. One of them, is very basic, there is just the above mentioned script added to _main.js, I double-checked with scripts.min.js, also contained in here. the grunt-job runs without failure, so that can’t be causing it.

Then you need to upload the updated script to your server. The current version does not contain your mailto function.

That’s what I did. I added a mailto function, ran grunt succesfully and uploaded to the server.

All I can tell you is the script on your live server does not contain the mailto function; and that the function itself compiles fine locally (on Roots 6.5.1).

You’ll have to debug your workflow to find out what the problem is.