HTML and CSS Reference
Problem Solving: E-Mail Links and Spam
Use caution when adding e-mail links to your Web site. While it may make it more conve-
nient for users to contact you, it also might make you more vulnerable to spam. Spam is
unsolicited e-mail sent to large numbers of people, promoting products, services, and in
some cases inappropriate Web sites. Spammers create their e-mail lists by scanning discus-
sion groups, stealing Internet mailing lists, and using programs called e-mail harvesters to
scan HTML code for the e-mail addresses contained in mailto URLs. Many Web developers
have removed e-mail links from their Web sites in order to foil these harvesters, replac-
ing the links with Web forms that submit e-mail requests to a secure server. If you need to
include an e-mail address as a link on your Web page, you can take a few steps to reduce
your exposure to spammers:
• Replace the text of the e-mail addresses with inline images that are more difficult for
e-mail harvesters to read.
• Write a program to scramble any e-mail addresses in the HTML code, unscrambling the
e-mail address only when a user clicks it.
• Replace the characters of the e-mail address with escape characters. For example, you
can replace the @ symbol with the escape sequence %40.
There is no quick and easy solution to this problem. Fighting spammers is an ongoing
battle, and they have proved very resourceful in overcoming some of the defenses people
have created. As you develop your Web site, you should carefully consider how to handle
e-mail addresses and review the most current methods for safeguarding that information.
Working with Hypertext Attributes
HTML provides several attributes to control the behavior and appearance of your links.
Gerry suggests that you study a few of these to see whether they would be effective in his
All of the hypertext
with the <a> tag can
also be applied to the
<area> tags within your
Opening a Secondary Window or Tab
By default, each page you open replaces the contents of the current page in the browser
window. This means that when Gerry's readers click on one of the four external links
listed on the Tips page, they leave the CAMshots Web site. To return to the Web site, a
user would have to click the browser's Back button.
Gerry wants his Web site to stay open when a user clicks one of the links to the exter-
nal Web sites. Most browsers allow users to open multiple browser windows or multiple
tabs within the same browser window. Gerry suggests that links to external sites be
opened in a second browser window or tab. This arrangement allows continual access to
his Web site, even as users are browsing other sites.
To force a document to appear in a new window or tab, you add the target attribute
to the <a> tag. The general syntax is
<a href=” url ” target=” window ”> content </a>
where window is a name assigned to the new browser window or browser tab. The value
you use for the target attribute doesn't affect the appearance or content of the page being
opened; the target simply identifi es the different windows or tabs that are currently open.
You can choose any name you wish for the target. If several links have the same target
name, they all open in the same location, replacing the previous content in the browser
window or tab. HTML also supports the special target names described in Figure 2-43.