The trick here is to do a mailto: link and pass URL-encoded parameters called “subject” and “body”. I found that the ridiculous Windows email client on this machine (which I never use except for testing this) doesn’t understand spaces encoded as “+”, it needs “%20″.
<a href=”mailto:?subject=This%20is%20the%20subject&body=http://yoururlgoeshere/”>Email this</a>
The ampersand “&” between the parameters is HTML encoded which is a bit fussy but correct.
Filed under: Hints and Tips, HTML
No comments »
Here’s an example of URL encoding from the article Forms and buttons: Sending data to the server:
formtest2.html?message1=Things+%26+stuff&ucannotseeme=boo!&message2=Hello+World
Why URL encoding? Well, firstly, data items in the request is separated by and ampersand “&”. In the above example, the hidden data contains an ampersand. If this wasn’t encoded somehow then how can anyone know where the data item ends? So “&” becomes “%26″ (it’s ASCII value [numeric code representing the character] written in hexadecimal [a number system common on computers which uses 16 digits instead of the 10 digits used in binary])
(more…)
Filed under: Hints and Tips
No comments »
Using google is an everyday event for a large percentage of the human population. Ever wonder what is going on when you hit the button? Here’s a working example which searches this site (right click and save then double click it to try it out). Ignore the complicated header, it’s just so the example validates.
We surround the information to be sent in a FORM tag:
<form action="http://www.jameswilkesdesign.co.uk/" method="get">
(more…)
Filed under: Hints and Tips, HTML
No comments »
Long webpages often have a link to take the user back to the top of the page. 2 things are needed for this. Immediately inside the body tag of your HTML document put:
This is an anchor, with a specified name. To link to it you use a link the name, prefixed with # to show that the link is to the same page (this tells the browser it doesn’t need to reload the page)
<a href=”#top”>Back to top</a>
You can also use this to make a table of contents by putting anchors at the start of each section of the page.
Filed under: Hints and Tips, HTML
No comments »
Often you see links which open up your email program with the address already filled in for you. Here’s how you do it:
<a href=”mailto:bob@example.com”>bob@example.com</a>
(more…)
Filed under: Hints and Tips, HTML
No comments »