Author Topic: How do I create a JavaScript email address?  (Read 297 times)

Offline Nicky

  • Posts: 94
  • Gender: Male
How do I create a JavaScript email address?
« on: May 03, 2020, 06:30:50 PM »
Hello Bakers!

How do I create a JavaScript email address?

I’m using a paid WB template which uses a lot of JavaScript.  The template works really well, I like it, but the only problem I have is not being able to save the markup of a simple obfuscated JavaScript mailto: which I have in two other WB sites (but running on different templates).

What happens is that when I save the WYSIWYG section with the JavaScript in the source, the script disappears after saving and I end up with a straightforward mailto: which I don’t want because of spam.  :-(

I have tried everything I know, so I thought to ask here. My ideas…

a) Instead of a WYSIWYG section is there a way to use a WB CODE section to achieve this?
b) Do I have to format a WYSIWYG section in such a way as to make the JavaScript script,  “stick” after saving and not disappear?
c) Do I have to somehow poke a hole in the HTML’s page's JavaScript then insert the mailto Javascript code and then close the hole again ?
d) Is there a more modern approach to obfuscating the email address? With PHP perhaps? — I've been using the same Javascript method for the last 15 years.

I'm not a programmer but I can code some simple CSS. I already have a myname(arobase)gmail(point)com on my site already, but I would like to publish a clickable mailto link also.  :-)

My JavaScript script isn't faulty because the same script works with other WB templates. Other widget Javascript script that I've added to the index.php of the template works ok.

WB-Version
2.12.2 r379

Offline dbs

  • Betatester
  • **
  • Posts: 8402
  • Gender: Male
  • tioz4ever
    • WebsiteBaker - jQuery-Plugins - Module - Droplets - Tests
Re: How do I create a JavaScript email address?
« Reply #1 on: May 03, 2020, 07:13:20 PM »
Hello, are you familiar with the function for masking e-mail addresses?
https://help.WebsiteBaker.org/en/userguide/working-with-wb/admin-tools.php#anchor4

Offline LudwigSt

  • Posts: 331
Re: How do I create a JavaScript email address?
« Reply #2 on: May 04, 2020, 10:24:58 AM »
a) Instead of a WYSIWYG section is there a way to use a WB CODE section to achieve this?
This should work, or module Code2.
Wissen ist Macht - aber nix wissen macht auch nix.

Offline Nicky

  • Posts: 94
  • Gender: Male
Re: How do I create a JavaScript email address?
« Reply #3 on: May 04, 2020, 02:56:29 PM »
Thanks to LudwigST and dbs !  :-)

— I couldn't get Code to work but Code2 worked instantly !!

— Thanks for the tip about the frontend filter. I had forgotten about that function. I have tried it and it works ok. I haven't used it this time around but I'll keep it in mind for the future.

Regards and thanks again,

:-D

 

postern-length