Learn to Add a "Gmail This" Bookmarklet to Your Browser Quick and Easy

Quickly email any URL with this JavaScript code

Close-Up Of Books On Table
Lisa Kehoffer / EyeEm / Getty Images

If you like to send web page links over Gmail, then you'll love this bookmarklet called "Gmail This." 

Bookmarklets are snippets of JavaScript code that can run in your browser to do all sorts of things. This one makes it a lot easier to email a website link since the alternative method is to copy the link manually and then open Gmail to compose a new message. From there, you'd have to paste the URL and then choose an appropriate text for the Subject line.

This particular bookmarklet will compose the message automatically, complete with the URL to the page and the website title pre-written in the Subject line.

How to Use "Gmail This"

Go into your web browser and make a new bookmark/favorite. Title it whatever you want, but in the "URL" section, paste the code shown here: 

javascript:(function(){popw='';Q='';d=document;w=window;if(d.selection){Q=d.selection.createRange().text;}else if(w.getSelection){Q=w.getSelection();}else if(d.getSelection){Q=d.getSelection();}popw=w.open('http://mail.google.com/mail/s?view=cm&fs=1&tf=1&to=&su='+encodeURIComponent(d.title)+'&body='+encodeURIComponent(Q)+escape('%5Cn%5Cn')+encodeURIComponent(d.location)+'&zx=RANDOMCRAP&shva=1&disablechatbrowsercheck=1&ui=1','gmailForm','scrollbars=yes,width=680,height=575,top=175,left=75,status=no,resizable=yes');if(!d.all)setTimeout(function(){popw.focus();},50);})();

It's this code that will run on the page instead of loading a website URL like what would normally occur if you typed an actual web page address as the destination URL.

Make sure you're logged into Gmail and then just click the bookmarklet when you're on the website you want to share. A new message will pop up just like when you compose a regular email in Gmail.

By default, the page's title will become the subject and the link will be copied into the body of the email, but you can edit anything as you wish and choose who to send it to.

Note: Copy this JavaScript code from JSFiddle if the bookmarklet doesn't work with the code you see above.

Was this page helpful?