954,574 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Email address showing as mailto link on webpage

Whenever I echo or print a string containing an email address to my webpage the HTML code automatically parses the text and shows it as a "mailto" link.

If I use... echo "Hello";

it prints Hello as expected on the webpage.

If I use... echo "hello@whatever.com";

it now appears as a mailto link, and if I look at the HTML code source the email address now contains all of this additional javascript...

<script language='JavaScript' type='text/javascript'> <!-- var prefix = 'ma' + 'il' + 'to'; var path = 'hr' + 'ef' + '='; var addy27400 = 'myemail' + '@'; addy27400 = addy27400 + 'hotmail' + '.' + 'com'; document.write( '<a ' + path + '\'' + prefix + ':' + addy27400 + '\'>' ); document.write( addy27400 ); document.write( '<\/a>' ); //-->\n </script> <script language='JavaScript' type='text/javascript'> <!-- document.write( '<span style=\'display: none;\'>' ); //--> </script>This e-mail address is being protected from spambots. You need JavaScript enabled to view it <script language='JavaScript' type='text/javascript'> <!-- document.write( '</' ); document.write( 'span>' ); //--> </script>


My question is, how can I show email addresses on my webpage in plain text (i.e. not as an email link)?

nigelburrell
Light Poster
38 posts since Jun 2009
Reputation Points: 11
Solved Threads: 0
 

Which editor are you using?

__avd
Posting Genius (adatapost)
Moderator
8,648 posts since Oct 2008
Reputation Points: 2,136
Solved Threads: 1,241
 

change

document.write( '<a ' + path + '\'' + prefix + ':' + addy27400 + '\'>' ); document.write( addy27400 ); document.write( '<\/a>' );

to document.write( addy27400);

that should do it!

heroic
Newbie Poster
14 posts since Jun 2009
Reputation Points: 10
Solved Threads: 0
 
Which editor are you using?

I'm developing a joomla CMS website, so the editor is an inbuilt editor. I don't think the problem is with the editor itself as all PHP code is saved as is. I simply code echo "myemail@whatever.com" and the resulting webpage shows the text as a "mailto" (active) link. All I want is for the email address to show as plain text.

The conversion appears to occur between the PHP code being sent to the server for processing, and the page output itself. But I have no idea where this javascript code comes from.

nigelburrell
Light Poster
38 posts since Jun 2009
Reputation Points: 11
Solved Threads: 0
 

change

document.write( '' ); document.write( addy27400 ); document.write( '<\/a>' ); to document.write( addy27400); that should do it!

Thanks for the code change suggestion, however, I don't code this javascript into my webpage in the first place... that's the problem. I don't know where this javascript script comes from, and I don't want it to be there. I simply code echo "myemail@whatever.com" into my PHP page and then when it outputs to the screen the email address has automatically been converted from plain text to a "mailto" (active) link. I want it to appear simply as plain text.

nigelburrell
Light Poster
38 posts since Jun 2009
Reputation Points: 11
Solved Threads: 0
 

Did you try with or tags?

__avd
Posting Genius (adatapost)
Moderator
8,648 posts since Oct 2008
Reputation Points: 2,136
Solved Threads: 1,241
 

the cms appears to have a function built in to obfuscate email addresses, this obfuscation is the javascript shown.
check the settings in the cms for obfuscation and change it from auto to manual, (maybe).
or try emailaddress@domain.com

almostbob
Posting Sensei
3,149 posts since Jan 2009
Reputation Points: 571
Solved Threads: 376
 

if dat doesn't work, i can try n fix it for you...

PS i am a pro php programmer :P

heroic
Newbie Poster
14 posts since Jun 2009
Reputation Points: 10
Solved Threads: 0
 
the cms appears to have a function built in to obfuscate email addresses, this obfuscation is the javascript shown. check the settings in the cms for obfuscation and change it from auto to manual, (maybe). or try emailaddress@domain.com

Exactly!! Thanks for your suggestion. I'm using Joomla cms and I did some research after reading your post and have just discovered that it does indeed use an inbuilt javascript obfuscation, however, I cannot find any setting in the cms for turning it off or on (auto to manual). I'm certain this is the "culprit".

No doubt the obfuscation function is there for good valid reasons, i.e. protection against spam, but I'm only wanting to show the email addresses in user-access webpages, not publicly accessable pages.

I tried the emailaddress@domain.com but still appears as an email link on the webpage.

Does anyone know where this setting could be in joomla?

nigelburrell
Light Poster
38 posts since Jun 2009
Reputation Points: 11
Solved Threads: 0
 
the cms appears to have a function built in to obfuscate email addresses, this obfuscation is the javascript shown. check the settings in the cms for obfuscation and change it from auto to manual, (maybe). or try emailaddress@domain.com

Ok, I found it... in the cms there's an email cloacking plug-in. All I needed to do was disable it. Thanks for pointing me in the right direction, and thanks to everyone for their suggestions and help.

nigelburrell
Light Poster
38 posts since Jun 2009
Reputation Points: 11
Solved Threads: 0
 

's good when it works

almostbob
Posting Sensei
3,149 posts since Jan 2009
Reputation Points: 571
Solved Threads: 376
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You