Welcome to WebmasterWorld Guest from 50.19.0.90

Forum Moderators: phranque

Message Too Old, No Replies

Encoded mailto text link gives me 404 error

No javascript

     
7:41 pm on May 3, 2012 (gmt 0)

Junior Member

5+ Year Member

joined:Nov 2, 2009
posts: 191
votes: 0


I'm implementing a simple mailto link, but just econded the email to avoid spam (I don't want to use javascript). However is not working when I click it I get this on browser address bar


http://www.example.com/mailto:informes@ba
?Subject=Mysubject%20Bla

Seems like is not understanding is a mailto link.

What's the problem?

code I use on html body
!-- #BeginLibraryItem "/Library/languages-brasil.lbi" -->

[edited by: phranque at 7:39 am (utc) on May 4, 2012]
[edit reason] edited to fix sidescroll [/edit]

7:59 pm on May 3, 2012 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:May 24, 2002
posts:894
votes: 0


Try this one :

<a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;&#105;&#110;&#102;&#111;&#114;&#109;&#101;&#115;&#64;
&#98;&#229;&#114;&#105;&#108;&#111;&#99;&#104;&#101;&#46;&#101;&#115;&#112;&#46;&#98;&#114;">Contato</a>

[edited by: phranque at 8:25 pm (utc) on May 3, 2012]
[edit reason] fixed sidescroll [/edit]

8:11 pm on May 3, 2012 (gmt 0)

Junior Member

5+ Year Member

joined:Nov 2, 2009
posts: 191
votes: 0


Thank you. I did.

It doesn't work inside the library item (is exactly the same code, but without the subject thing)...

It does work outside the library item. The problem is that link has to be in my nav bar.

What's wrong with putting it inside the library? Any workaround?
8:18 pm on May 3, 2012 (gmt 0)

Senior Member

WebmasterWorld Senior Member 5+ Year Member

joined:Feb 12, 2006
posts:2492
votes: 22


you've got it looking like a URL, with a domain name at the beginning. you don't need that for a mailto address.
it should look something like this

<a href="mailto:someone@example.com?subject=Title">blah</a>


so you need to encode this bit...
mailto:someone@example.com?subject=Title


... if its not working maybe you've got a base href set in the <head> ? it might be adding the domain name to the beginning because of that

[edited by: londrum at 8:28 pm (utc) on May 3, 2012]

8:28 pm on May 3, 2012 (gmt 0)

Junior Member

5+ Year Member

joined:Nov 2, 2009
posts: 191
votes: 0


Why do you say that? My code is exactly a mailto link but just encoded..
8:31 pm on May 3, 2012 (gmt 0)

Senior Member

WebmasterWorld Senior Member 5+ Year Member

joined:Feb 12, 2006
posts:2492
votes: 22


because you said when you click it, you get taken to http://www.example.com..blah blah in the address bar.
that doesnt happen with a mailto link

hover over the mailto link, and see what it says in the status bar
8:39 pm on May 3, 2012 (gmt 0)

Junior Member

5+ Year Member

joined:Nov 2, 2009
posts: 191
votes: 0


Seems you have a point.
Hovering shows
http://www.example.com/&#109;&#97;&#105;&#108;&#116;&#111;:
&#105;&#110;&#102;&#111;&#114;&#109;&#101;&#115;&#64;&#98;&#97;&#114;&#105;&#108;&#111;
&#99;&#104;&#101;&#46;&#101;&#115;&#112;&#46;&#98;&#114;?Subject=Contato%20from%20www.example.

How do I get rid of the http://www.example.com part?

[edited by: phranque at 7:41 am (utc) on May 4, 2012]
[edit reason] edited to fix sidescroll [/edit]

7:43 am on May 4, 2012 (gmt 0)

Administrator

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Aug 10, 2004
posts:10542
votes: 8


you need to use an href attribute value which doesn't look like a relative url to the browser, which means you probably have to leave at least the url scheme (mailto:) unencoded.
7:26 pm on May 4, 2012 (gmt 0)

Junior Member

5+ Year Member

joined:Nov 2, 2009
posts: 191
votes: 0


Thanks! But sadly didn't work. Doing such a thing results in mailto working opening email client but in TO field appears literally: "&#109;&#101;&#115;&#64;&#98;&#97;&#114;&#105;&#108;&#111;
&#99;&#104;&#101;&#46;&#101;&#115;&#112;&#46;&#98;&#114"

So no joy either.
7:36 pm on May 4, 2012 (gmt 0)

Senior Member

WebmasterWorld Senior Member 5+ Year Member

joined:Feb 12, 2006
posts:2492
votes: 22


encoding it won't protect it from spambots anyway, it's an old-school trick, about a hundred years old.

if it's protection from spambots you're after, then it's probably no protection at all.

what's the problem with using javascript? at least you'll get a little bit of protection with that.
8:24 pm on May 4, 2012 (gmt 0)

Junior Member

5+ Year Member

joined:Nov 2, 2009
posts: 191
votes: 0


old school or not worked fine to me for years, no complains. but doesn't into library items, what is a problem. (I'll have to move to jscript seems)
10:12 pm on May 4, 2012 (gmt 0)

Junior Member

5+ Year Member

joined:Nov 2, 2009
posts: 191
votes: 0


I couldn't find a javascript allowing body variable in several lines.
Like:
"please tell us about you

name:
age:
and so on:
"

That's something actually I can do with my old school technique.
3:33 pm on May 5, 2012 (gmt 0)

Senior Member

WebmasterWorld Senior Member 5+ Year Member

joined:Feb 12, 2006
posts:2492
votes: 22


you dont need to javascript the whole thing, just the email address. the rest of the mailto link (including the subject and body variables) can be written like normal.

if you google "javascript email obfuscation" you'll get loads of ways to hide it
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members