Opera Send Link By Mail Bookmarklet:
Function: Creates and opens a mailto URI containing the document's title
(for the subject) and the document's location (for the body).
Modes: At the end of the javascript URI below, you can set the mode. The default is
"normal".
normal: Document's location comes out as in the body
field.
Modes specific to Thunderbird when you have HTML composition on in
Thunderbird and use Thunderbird 2.x, or use Thunderbird 3.x with the
thunderbird.exe -compose "body=value,subject=value" command syntax to pass
a mailto URI to Thunderbird 3.x:
tbird1: Document's location comes out as an HTML link encased in brackets
whose HTML source would be
<http://example.com/>
tbird2: Document's location comes out as whose HTML
source would be <http://example.com/>
Here's the javascript URI:
javascript:(function(mode)%7Bfunction%20enc(s)%7Btry%7Breturn%20encodeURIComponent(s)%7Dcatch(e)%7Breturn%20%22Opera%2520received%2520an%2520error%2520while%2520percent-encoding%2520the%2520data%22%3B%7D%7Dvar%20sub%3Denc(document.title)%3Bvar%20loc%3Ddocument.location%3Bvar%20body%3Denc(%22%3C%22%2Bloc%2B%22%3E%22)%3Bif(mode%3D%3D%22tbird1%22)%7Bbody%3Denc('%26lt%3B%3Ca%20href%3D%22'%2Bloc%2B'%22%3E'%2Bloc%2B'%3C%2Fa%3E%26gt%3B')%3B%7Delse%20if(mode%3D%3D%22tbird2%22)%7Bbody%3Denc(%22%26lt%3B%22%2Bloc%2B%22%26gt%3B%22)%3B%7Dvar%20uri%3D%22mailto%3A%3Fsubject%3D%22%2Bsub%2B%22%26body%3D%22%2Bbody%3Bwindow.open(uri)%3B%7D)(%22normal%22)%3B
Here's the compressed source:
(function(mode){function enc(s){try{return encodeURIComponent(s)}catch(e){return "Opera%20received%20an%20error%20while%20percent-encoding%20the%20data";}}var sub=enc(document.title);var loc=document.location;var body=enc("<"+loc+">");if(mode=="tbird1"){body=enc('<'+loc+'>');}else if(mode=="tbird2"){body=enc("<"+loc+">");}var uri="mailto:?subject="+sub+"&body="+body;window.open(uri);})("normal");
Here's the source of the javascript URI:
(function(mode) {
function enc(s) {
try {
return encodeURIComponent(s)
} catch (e) {
return "Opera%20received%20an%20error%20while%20percent-encoding%20the%20data";
}
}
var sub = enc(document.title);
var loc = document.location;
var body = enc("<" + loc + ">");
if (mode == "tbird1") {
body = enc('<' + loc + '>');
} else if (mode == "tbird2") {
body = enc("<" + loc + ">");
}
var uri = "mailto:?subject=" + sub + "&body=" + body;
window.open(uri);
})("normal");
Note: When using window.open to open the mailto URI, Opera will undo some of
the percent-encoding done by encodeURIComponent above. Opera will take %3A and
%2F and decode them to :/ on you. This means Opera will pass:
mailto:?body=%3Chttp://www.opera.com/%3E
instead of the expected:
mailto:?body=%3Chttp%3A%%2F%2Fwww.opera.com%2F%3E
to the mail client.