Tuesday, February 11, 2014

Send Email Link Bookmark for Chrome

In the Google Chrome browser for Mac, there's a built-in "Send Link" command to email the URL of the current page via your default email client. For whatever reason, that doesn't automatically exist in the Windows version. 

Fortunately, the fix is simple. We'll make a Javascript bookmarklet:
  • In Chrome, right-click in the Bookmarks Bar on an existing bookmark and select "Add Page" (the new bookmark will appear to the right of the one on which you right-clicked).
  • In the "Name:" field, enter "Send Link" (or whatever sounds good to you)
  • In the "URL:" field, paste the following text:
javascript:(function(){ window.open('mailto:?SUBJECT='+document.title+'&BODY='+escape(location.href)); })();
  • Click "Save" in the lower-right of the Edit Bookmark dialog. Your new "Send Link" bookmark should appear in the Bookmarks Bar.
You can also drag this link into Chrome's Bookmarks Bar: Send Link

Now, if you want to email the URL of a page you're viewing in Chrome, simply click the "Send Link" bookmark, and a new email document with the title of the page as its Subject and the URL in the body of the email is created in a new browser tab. Just type in your recipient address and send.

P.S. If you want to be fancier with this little Javascript, enter some custom text immediately after SUBJECT= in the script. This will prepend a custom piece of text in your email's subject line before the existing title of the Web page. For example:
javascript:(function(){ window.open('mailto:?SUBJECT=A link from Sebastian: '+document.title+'&BODY='+escape(location.href)); })();
Note that the space after "Sebastian:" is deliberate, and will appear between the colon and the document title. This will generate a Subject line which reads:
Subject: A Link from Sebastian: [Web Page Title Here]