Response title
This is preview!
- $.post( '/mailto.php', { password: 'mypass' }, function(data) {
- $( 'span.email' ).html(data);
- })
mailto.php would returnThis used to work fine until a while ago: Google is now able to (partially) read Ajax loaded content. Could anyone advice me on what new method i should use for protecting my e-mail links? Thanks in advance! Regards, Knal
- <a href="mailto:me@example.com">me@example.com</a>
<script type=
"text/javascript"
>
function
createMailtoLinks(){
$(
'A[data-u][href=""]'
).each(
function
(){
var
i = $(
this
);
i.attr(
'href'
,
'mai'
+
'lto:'
+i.data(
'u'
)+
'@'
+i.data(
'd'
));
if
(i.html()==
''
){ i.html(i.data(
'u'
)+
'@'
+i.data(
'd'
)); }
});
}
$(
function
(){
createMailtoLinks();
});
</script>
<-- use your own anchor text -->
<a href=
""
data-u=
"username"
data-d=
"domain.com"
>anchor text</a>
<-- leave anchor text blank to auto-generate -->
<a href=
""
data-u=
"username"
data-d=
"domain.com"
></a>
© 2013 jQuery Foundation
Sponsored by and others.