473,396 Members | 1,814 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Hide email address with image as link

I'm hiding the email address on a website with this javascript which
works fine:
---------------------------------
<p>Send your comments and questions to our

<script language=javascript>

<!--

var contact = "Newsletter Editor"

var email = "news"

var emailHost = "netmechanic.com"

document.write("<a href=" + "mail" + "to:" + email + "@" + emailHost+
">" + contact + "</a>" + ".")

//-->

</script>

</p>
---------------------------------
How can I make an image instead of the text as a link to start this
script?

Thanks in advance

Mar 9 '06 #1
17 2125
HornyLaBelle said the following on 3/9/2006 6:42 AM:
I'm hiding the email address on a website with this javascript which
works fine:
No, you just think it works fine.
---------------------------------
<p>Send your comments and questions to our

<script language=javascript>
<script type="text/javascript">
<!--
Drop the ill conceived notion of hiding scripts.
var contact = "Newsletter Editor"

var email = "news"

var emailHost = "netmechanic.com"

document.write("<a href=" + "mail" + "to:" + email + "@" + emailHost+
">" + contact + "</a>" + ".")

//-->
Drop the hiding scripts, it isn't needed anymore and can actually do
harm in some circumstances.
</script>

</p>
---------------------------------
How can I make an image instead of the text as a link to start this
script?


Instead of the variable contact, you would write out an img tag.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Mar 9 '06 #2
HornyLaBelle wrote:
I'm hiding the email address on a website with this javascript
Utter nonsense.
which works fine:


No, it does not.
PointedEars
Mar 9 '06 #3
<p>Send your comments and questions to our
<script language=javascript>
<!--
var contact = '<img src="gfx/some_image.png" alt="email me">'
var email = "news"
var emailHost = "netmechanic.com"
document.write("<a href=" + "mail" + "to:" + email + "@" +
emailHost+
">" + contact + "</a>" + ".")
//-->
</script>
</p>



Mar 9 '06 #4
//-->


Drop the hiding scripts, it isn't needed anymore and can actually do
harm in some circumstances.


Why? What's the problem?
Mar 9 '06 #5
> > How can I make an image instead of the text as a link to start this
script?


Instead of the variable contact, you would write out an img tag.


I tried this but it doesn't work. Can you please give an example? I
don't know a lot about javascript...

Mar 9 '06 #6
Gernot Frisch wrote:
//-->


Drop the hiding scripts, it isn't needed anymore and can actually do
harm in some circumstances.

Why? What's the problem?


The main problem is that some script authors think they can use HTML style
comments anywhere in the script, then can't work out why it won't run.

The tags also get carried over to .js files where their potential effects
can be masked further. The content of script elements should be passed
as-is to the script engine. It seems that modern browsers either remove
the tags before passing the content to the script engine, or the engine
itself deals with them. Provided the opening tag comes before any real
script they don't cause a problem, but that can't be relied upon /ad
infinitum/.

Note that comments should never have been required for script elements
inside the head, which is where most of them are.

Another potential hazard is if the tags are used with XHTML - but again
some browsers seem to 'fix' that.

--
Rob
Mar 9 '06 #7

"HornyLaBelle" <sa****@gmx.de> schrieb im Newsbeitrag
news:11**********************@u72g2000cwu.googlegr oups.com...
> How can I make an image instead of the text as a link to start
> this
> script?


Instead of the variable contact, you would write out an img tag.


I tried this but it doesn't work. Can you please give an example? I
don't know a lot about javascript...


See my other reply - it's all there
Mar 9 '06 #8
Greetings,

First I must apologize for users like PointedEars who somehow think
they are making a contribution by bad mouthing people who need help. It
seems every post they make does nothing to further anyone's
knowledge.

Here is how you would fix your code to use an image:

<script language=javascript>
var contact = "Newsletter Editor";
var email = "news";
var emailHost = "netmechanic.com";
document.write("<a href='mailto:"+email+"@"+emailHost+"'><img
src='http://groups.google.com/groups/img/groups_medium.gif' width='150'
height='58' border='0'>"+contact+"</a>");
</script>

Also, if interested I have written a free JavaScript utility I use for
all my clients that encrypts email links for you. You can even pass it
a CSS class to use While the method you are using works for basic
protection, malicious harvesting robots can still read your source code
and piece things together. Especially when you use keywords like
"email".

http://www.manifestinteractive.com/tools/hiddenemail/

Hope this helps,
Peter Schmalfeldt

HornyLaBelle wrote:
I'm hiding the email address on a website with this javascript which
works fine:
---------------------------------
<p>Send your comments and questions to our

<script language=javascript>

<!--

var contact = "Newsletter Editor"

var email = "news"

var emailHost = "netmechanic.com"

document.write("<a href=" + "mail" + "to:" + email + "@" + emailHost+
">" + contact + "</a>" + ".")

//-->

</script>

</p>
---------------------------------
How can I make an image instead of the text as a link to start this
script?

Thanks in advance


Mar 9 '06 #9
Manifest Interactive wrote:
First I must apologize for users like PointedEars who somehow think
they are making a contribution by bad mouthing people who need help.
It seems every post they make does nothing to further anyone's
knowledge.
At least I /know/ what I am talking about.

You are not helping the OP by posting this "solution", you are hurting
him/her in the mid-term. Because e-mail communication will be impossible
for many, if not most, of his/her users while you give the false impression
that this would be a viable approach that serves at least many users.
There is a word for that: incompetence.
Here is how you would fix your code to use an image:

<script language=javascript> ^^^^^^^^^^^^^^^^^^^^ var contact = "Newsletter Editor";
var email = "news";
var emailHost = "netmechanic.com";
document.write("<a href='mailto:"+email+"@"+emailHost+"'><img
src='http://groups.google.com/groups/img/groups_medium.gif' width='150'
height='58' border='0'>"+contact+"</a>"); ^^^^
The markup is not Valid, and therefore not supposed to be interoperable.

1. The `language' attribute is deprecated long since (December 1999),
the `type' attribute is required. The language attribute is not
Valid in HTML 4.01 Strict, XHTML 1.0 Strict, and XHTML 1.1.

2. mailto: is known to be highly unreliable (IOW: known not to work).

3. Writing the link with client-side scripting and so introducing a
dependency on that technique makes it even worse.

4. The `img' element requires the `alt' attribute, as text alternative
if the image cannot be displayed.

5. ETAGO delimiters </ must be escaped within CDATA element content, or
the element is considered to end prematurely by the markup parser,
causing a syntax error for the script engine here.

So there are the following possibilities:

1. There is no client-side script support, the script is filtered by a
proxy, or the client works strictly standard compliant:

The user sees exactly nothing, and depending on the strictness of
the parser, if there is client-side script support, and the script
is not filtered, the user gets a nice error message, too.

2. There is client-side script support, the script is not filtered,
and despite the markup being not Valid the script is executed, but

a) the user is blind or visually impaired, and therefore can not find
the link (there is no text that can be interpreted by a Braille line
or read to him aloud by a screenreader);
b) there is no e-mail client installed;
c) the HTML user agent (UA) does not support mailto: URIs;
d) the e-mail client is not configured with the UA to handle mailto: URIs

Where each of b) to d) is highly likely with users having a Web mail
account.

For the infinitesimal tiny rest of users, this nonsense actually works.
Big time.
[unsolicited advertising]
[top post]


FOAD!
PointedEars
Mar 9 '06 #10
Thomas 'PointedEars' Lahn wrote:
1. There is no client-side script support, the script is filtered by a
proxy, [...]


.... or by a "desktop firewall", or it is rendered not working by that
(such as with Norton InSecurity). And probably I forgot something more.
PointedEars
Mar 10 '06 #11
The "PointedEars" must be your horns. Oh, and by the way, here is a
word you obviously need the definition to, must be the ONLY thing you
don't know, right?

------------------------------------------------------

ad·ver·tise
v. ad·ver·tised, ad·ver·tis·ing, ad·ver·tis·es
v. tr.

To make public announcement of, especially to proclaim the qualities or
advantages of (a product or business) so as to increase sales.

------------------------------------------------------

Me providing a link to a free tool I wrote that has no marketing on it
that can help people better secure their email links is a NICE and
POLITE thing that I do to HELP people. It is certainly not
"unsolicited advertising". They can even take it and use it
themselves if they want. I don't care. (I capitalized the "big
words" you might not understand).

Well, I am off to help other people, I am sure I will see a response
following this outlining many ways that nothing I submit will work.,
just like you do on everyone else's messages. Sure hope you don't
talk to people in person the way you do on here.

Here's a challenge for you. Write one nice response to a user, come
back here and post the link so I can see that you actually helped
someone out. My bet is that I will never see anything.

Later pessimist

PS, your site http://www.pointedears.de/ needs a lot of work bro.

- Peter Schmalfeldt

Thomas 'PointedEars' Lahn wrote:
Manifest Interactive wrote:
First I must apologize for users like PointedEars who somehow think
they are making a contribution by bad mouthing people who need help.
It seems every post they make does nothing to further anyone's
knowledge.


At least I /know/ what I am talking about.

You are not helping the OP by posting this "solution", you are hurting
him/her in the mid-term. Because e-mail communication will be impossible
for many, if not most, of his/her users while you give the false impression
that this would be a viable approach that serves at least many users.
There is a word for that: incompetence.
Here is how you would fix your code to use an image:

<script language=javascript>

^^^^^^^^^^^^^^^^^^^^
var contact = "Newsletter Editor";
var email = "news";
var emailHost = "netmechanic.com";
document.write("<a href='mailto:"+email+"@"+emailHost+"'><img
src='http://groups.google.com/groups/img/groups_medium.gif' width='150'
height='58' border='0'>"+contact+"</a>");

^^^^
The markup is not Valid, and therefore not supposed to be interoperable.

1. The `language' attribute is deprecated long since (December 1999),
the `type' attribute is required. The language attribute is not
Valid in HTML 4.01 Strict, XHTML 1.0 Strict, and XHTML 1.1.

2. mailto: is known to be highly unreliable (IOW: known not to work).

3. Writing the link with client-side scripting and so introducing a
dependency on that technique makes it even worse.

4. The `img' element requires the `alt' attribute, as text alternative
if the image cannot be displayed.

5. ETAGO delimiters </ must be escaped within CDATA element content, or
the element is considered to end prematurely by the markup parser,
causing a syntax error for the script engine here.

So there are the following possibilities:

1. There is no client-side script support, the script is filtered by a
proxy, or the client works strictly standard compliant:

The user sees exactly nothing, and depending on the strictness of
the parser, if there is client-side script support, and the script
is not filtered, the user gets a nice error message, too.

2. There is client-side script support, the script is not filtered,
and despite the markup being not Valid the script is executed, but

a) the user is blind or visually impaired, and therefore can not find
the link (there is no text that can be interpreted by a Braille line
or read to him aloud by a screenreader);
b) there is no e-mail client installed;
c) the HTML user agent (UA) does not support mailto: URIs;
d) the e-mail client is not configured with the UA to handle mailto: URIs

Where each of b) to d) is highly likely with users having a Web mail
account.

For the infinitesimal tiny rest of users, this nonsense actually works.
Big time.
[unsolicited advertising]
[top post]


FOAD!


PointedEars


Mar 10 '06 #12

Manifest Interactive schrieb:
Here is how you would fix your code to use an image:

<script language=javascript>
var contact = "Newsletter Editor";
var email = "news";
var emailHost = "netmechanic.com";
document.write("<a href='mailto:"+email+"@"+emailHost+"'><img
src='http://groups.google.com/groups/img/groups_medium.gif' width='150'
height='58' border='0'>"+contact+"</a>");
</script>


Manifest Interactive, thanks a lot, but when I copy this script into my
html the image is not displayed. It only works with a text link. I
tried it several different ways, really strange...

Mar 10 '06 #13
Greetings,

Are you copying this script inside your body tag? Also, make sure that
you removed all the line breaks that this forum will put in the code.
In all total there should only be 6 lines of code including the <script
language=javascript> and </script> tags. If you have more than that,
then that is the problem.

Here is a link to a sample page I put up on my site for you:

http://www.manifestinteractive.com/u...imagelink.html

Just copy that code if you want. Hope this solves your problem.

- Peter Schmalfeldt

HornyLaBelle wrote:
Manifest Interactive schrieb:
Here is how you would fix your code to use an image:

<script language=javascript>
var contact = "Newsletter Editor";
var email = "news";
var emailHost = "netmechanic.com";
document.write("<a href='mailto:"+email+"@"+emailHost+"'><img
src='http://groups.google.com/groups/img/groups_medium.gif' width='150'
height='58' border='0'>"+contact+"</a>");
</script>


Manifest Interactive, thanks a lot, but when I copy this script into my
html the image is not displayed. It only works with a text link. I
tried it several different ways, really strange...


Mar 10 '06 #14
HornyLaBelle wrote:
Manifest Interactive schrieb:
Here is how you would fix your code to use an image:
[Invalid code]


Manifest Interactive, thanks a lot, but when I copy this script into
my html the image is not displayed. It only works with a text link.
I tried it several different ways, really strange...


Blind leading the blind ... It would be funny if it would not be so sad.

FWIW, you are looking for a (server-side) form mailer, such as
<URL:http://formmailer.com/ (or write your own in any server-side language;
I prefer PHP), not mailto: or client-side scripting, and certainly not the
nonsense provided by the incompetent spammer posing here. This way, your
e-mail address is known only server-side, not to the users (or a potential
spammer). And _all_ of them will be able to send you e-mail anyway. By
using POST requests and server-side sessions, you can successfully prevent
most attempts spamming to the resource the form points to.
HTH & HAND

PointedEars
Mar 10 '06 #15
Thomas 'PointedEars' Lahn said the following on 3/10/2006 10:36 AM:
and certainly not the nonsense provided by the incompetent spammer posing here.


Everything you said was 100% on the mark except the above. Nothing that
he has posted would qualify as "spam" and whether he is "posing" or
"posting" (I assume that to be a typo but it may be intentional) he
still hasn't spammed this group. It goes back to your typical behavior
of name calling when someone disagrees with you.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Mar 10 '06 #16

Manifest Interactive schrieb:
Are you copying this script inside your body tag? Also, make sure that
you removed all the line breaks that this forum will put in the code.
In all total there should only be 6 lines of code including the <script
language=javascript> and </script> tags. If you have more than that,
then that is the problem.


Manifest Interactive, thank you very much. The line breaks were the
problem. Now it works.

Mar 10 '06 #17

Horny LaBelle wrote:
Manifest Interactive schrieb:
Are you copying this script inside your body tag? Also, make sure that
you removed all the line breaks that this forum will put in the code.
In all total there should only be 6 lines of code including the <script
language=javascript> and </script> tags. If you have more than that,
then that is the problem.


Manifest Interactive, thank you very much. The line breaks were the
problem. Now it works.


You are welcome,
- Peter Schmalfeldt

Mar 12 '06 #18

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: sergio | last post by:
Hi all, I have created the following script that will show/hide a menu based on checkboxes. It works fine in Opera but not on IE6! Does anybody knows a workaround this problem? Thanks for your...
117
by: Steevo | last post by:
Any suggestions as to the best programs for cloaking email addresses? Many thanks -- Steevo
4
by: web_design | last post by:
I put this together from some other scripts I am using on a site. I'm trying to make a better email hiding script. It isn't working. Also, it causes Internet Explorer 6 SP2 to block the script...
1
by: frekster | last post by:
Hi. Looking for some feedback on how to prevent a specific spam attack. I have a form for a person to subscribe to a mailing list and they can type in their email and click submit to...
4
by: bridgemanusa | last post by:
Hi All: I have a very long page of html that I want to take portions and hide them in divs, then show when a link is clicked. I have the hide show part working when the link is clicked, however...
1
by: Mahernoz | last post by:
Hi Friends, I have a Registration page which uses Asp.net CreateUserWizard Control. Now I want to send a unique value(a guid) by which i can be sure that the email address is of that user only....
12
by: laredotornado | last post by:
Hi, I'm using PHP 5. I was wondering given an image, a.jpg, how can I make an image that would look like you slid a white index card (which I have a file, white.jpg with the same dimensions as...
0
Debadatta Mishra
by: Debadatta Mishra | last post by:
Introduction In this article I will provide you an approach to manipulate an image file. This article gives you an insight into some tricks in java so that you can conceal sensitive information...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.