Skip to content

Instantly share code, notes, and snippets.

@rondevera
Created June 26, 2009 03:58
Show Gist options
  • Save rondevera/136298 to your computer and use it in GitHub Desktop.
Save rondevera/136298 to your computer and use it in GitHub Desktop.
Gmail bookmarklet: For quickly e-mailing the current page's URL (and the selected text, if any) via Gmail.
/*
Gmail bookmarklet
rondevera.com
For quickly e-mailing the current page's URL (and the selected text, if any)
via Gmail.
Usage:
- Create a new item in your bookmark bar with the name "Gmail" (or just "Gm",
or your favorite Unicode character), and the code below as the location.
- Activate it (by click or keyboard shortcut), and a small Compose window
opens with the page's title, URL, and a couple of line breaks for you to
add a note. If you selected any text, it'll automatically be added with
quotation marks.
- Tested by daily use in Safari and Firefox. Might be too long
for less capable browsers (you know which one -- oh snap!).
Credit:
- Adapted from the GmailThis! bookmarklet:
http://contrapants.org/blog/2005/07/gmailthis.html
- MIT license
*/
javascript:(function(){popw='';Q='';x=document;y=window;if(x.selection){Q=x.selection.createRange().text;}else%20if(y.getSelection){Q=y.getSelection();}else%20if(x.getSelection){Q=x.getSelection();}popw=y.open('https://mail.google.com/mail?ui=2&view=cm&tf=0&to=&su='+escape(document.title.replace(/^\s+|\s+$/g,''))+'&body='+escape(location.href)+escape('\n\n'+(Q&&Q!=''?'"'+Q+'"':'')),'gmailForm','scrollbars=yes,width=500,height=400,top=50,left=50,status=no,resizable=yes');if(!document.all)T=setTimeout(function(){popw.focus()},50);void(0);})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment