Should mailto be used in HTML5?

倖福魔咒の 提交于 2019-12-01 02:34:21

You should use the mailto: URI scheme in both HTML4 and HTML5.
If the user doesn't want a mail client to load, he won't click the link.
Not using mailto: just makes it more annoying to send you email.

Any half-decent (indecent?) spam crawler will pick up email addresses whether or not they're in mailto:.

One effective way to prevent this is to include a (trivially-)encrypted version of the email address in Javascript and write it into the document.
This way, any spam crawlers that do not execute Javascript won't get your address.
If you're afraid of spam crawlers that do use Javascript, you can only write the email address on mousemove and/or after 5 seconds.
For accesibility reasons, and for humans with Javascript disabled, you may want to include a scrambled form of the address in plain text. (eg, SLaks (SHIFT+2) MyDomain (period) com)
You can write a server-side script to generate this automatically for an email address.

For obvious reasons, I won't share code. (In order for this to work well, each site should have a different implementation)

I usually see companies using a server-processed contact form instead of publishing email addresses. Most web geeks I know tend to use some sort of JavaScript obfuscation to write out their email addresses, which will admittedly leave non-JS browsers/users in the dust. A compromise would be to use images. (Yuck.)

To get to the heart of your question, I absolutely use mailto: all the time where appropriate. It is a meaningful way to convey to a browser what to do with a link. Users are free to configure what email client to open these links in using the relevant browser and/or OS options.

I recommend only using the mailto protocol when the displayed text is an email address; otherwise, the user may not understand that he is clicking on a mailto link.

As far as spam, if you put an email address in your HTML, it's susceptible to spam. You could use JavaScript to dynamically insert email addresses into the DOM, but users without JavaScript won't be able to see the email address.

My perception is that the use of mailto is not related to HTML5 or any other markup spec, but a matter of personal/company coding convention. If you choose to deprecate the protocol, then that's fine, but it will not make any notable difference to spam.

It might be useful to do some A/B testing to replace the mailto with a contact form and see the difference in response rates...

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!