Reminder:
Always be sure you trust or understand what a link does before you click it.
How do these links work?
-
<a href="www.google.com">
The text <a> is the HTML "anchor" element.
The text <a
href="www.google.com"> is a hyperlink attribute and value.
The text href is the name of the attribute
and the value for this attribute is placed inside the two quotes, which in this example is www.google.com.
Learn more about HTML here:
https://www.w3schools.com/tags/att_a_href.asp
-
<a href="mailto: ...>
The above hyperlinks use the "mailto" URI to direct your browser to an email
address instead of a website URL.
-
<a href="mailto: emailAddressToSendTo@domain.etc ...>
The next portion is the destination email address.
-
<a href="mailto: emailAddressToSendTo@domain.etc ? subject=SomeText ...>
Similar to website URLs, in a "URI" all the text after the question mark
(?) is called the "query string". The query
string is a series of named parameters and values separated by ampersands (e.g.
www.some.url?parameter1=value¶meter2=value2).
Query strings are used to pass values to the destination.
In this case, we're passing data to the "subject" and "body" parameters.
All this does is pre-populate the text in the subject field and
pre-populate the text in the body field when the mail client opens the link.
-
Condensed, the above code could alternatively be:
<a href="mailto:gamepad.coder@gmail.com?subject=Hi&body=Prepoulate&nbps;text.">
[Subject] This line is where the text for the green link comes from.
</a>
What does the %0A encoding do in these links?
-
A percent sign '%' followed by zero '0' and 'A'
(%0A)
is the URL encoding for the newline character.
What does the encoding do in these links?
-
The text
( )
is the HTML entity encoding for "a non-breaking space".
Non-breaking just means it won't insert a new line (or in other words, it won't
"break" the line).
-
I used it in these links for horizontal spacing and as a visual cue to emphasize
that the parenthetical surrounds the entire inserted note.
URL? URI? What's the difference?
To see a brief tutorial for mailto links,
click here:
https://css-tricks.com/snippets/html/mailto-links/
To read more about the mailto URI,
click here:
https://en.wikipedia.org/wiki/Mailto
To read more about HTML URL Encodings,
click here:
https://www.w3schools.com/tags/ref_urlencode.ASP