Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Mailing Safari URLs via Mail - revisited Web Browsers
Last week, a hint explained how to use AppleScript to email Safari URLs. Buried in the comments to that article is a gem of a tip with a different solution to the problem. Although this hint is clearly related to the first, it uses a completely different method, and I think it's worth running as a hint of its own. So here it is...

Full credit for this hint goes to amit_kr, who wrote:
I wanted the ability to do the same thing, and found a much simpler and convenient way. Drag this link (actually a javascript) to your bookmark bar; the content of the link is this line:
 javascript:location.href='mailto:?SUBJECT='+document.title+'&BODY='+escape(location.href)
Call it whatever (say 'e'). Since this is a bookmark (and not a folder), a hotkey is assigned to it (command-1 to command-9) by Safari.

Now whenever you need to send the page title and URL to someone, just press the hot key, and that's it!! A mail message is created with the title of the page as the subject, the URL as the body, and the cursor active on the "To:" field.

So one could select a part of the webpage, press Command-C (to copy), Command-2 (to compose Mail with URL and title already there), type in the recipient's address, hit tab twice, press Command-V (to paste the selection), and hit send!
This has become my first-position bookmark, so I can email URLs with a quick Command-1.
    •    
  • Currently 3.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (2 votes cast)
 
[20,428 views]  

Mailing Safari URLs via Mail - revisited | 22 comments | Create New Account
Click here to return to the 'Mailing Safari URLs via Mail - revisited' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Mailing Safari URLs via Mail - revisited
Authored by: bluehz on Mar 26, '03 10:07:55AM

Another similar javascript type link I use is one that resizes the current window in Safari. In my case I like the window full-screen, but others may prefer a different size (say for testing on smaller monitors, or leaving room for the doc, etc.)

1. Create a new bookmark in your bookmark bar - give it snazzy icon instead of text (see previous hints).
2. Assign this address:

javascript:moveTo(0,0);resizeTo(1147,825)

Note: the 2nd set of numbers is the width and height of the resized window. In my case I want fullscreen - so I just enter my screen resolution. If your monitor was 640x480 you would use "(640,480)" instead. Modify as desired.



[ Reply to This | # ]
resizeTo not working
Authored by: dashard on Mar 26, '03 10:39:46AM

resizeTo argument doesn't seem to work. Any ideas??
     Hmmmm...



[ Reply to This | # ]
resizeTo not working
Authored by: Voorburg on Mar 26, '03 10:55:10AM

Try a smaller size first and increase in gradually. When it's only 1 pixel too large is doesn't work anymore.
Jan



[ Reply to This | # ]
resizeTo not working
Authored by: dashard on Mar 26, '03 08:53:42PM
Actually got it to work. Here's the code:
javascript:moveTo(0,0),void(window.resizeTo(640,480))
Replace '640,480' with your desired window dimensions and you're good to go.
Remember: no space after the comma.

[ Reply to This | # ]
"Favelets"
Authored by: the_webmaestro on Mar 26, '03 10:49:39AM
This "tip" is something else RobG might want to move to stardom status, like the other e-mail one (a great tip, BTW).

The reason I mention this, is that it's not just for full screen, but what if you need to see what your web site looks like at 800x600? Or 640x480? When I was a code-monkey at buy.com, we used these little favelets to check our pages to make certain they did not have a horizontal scrollbar at 800x600 (one of our minimum requirements at the time). Tantek Çelik (project lead for Microsoft Internet Explorer for Mac v4x&5x) has created http://favelets.com/ a web site devoted to what he calls "favelets"--little bookmark javascript programs which can be used to do various things with the browser.

You can try these favelets right now by clicking them:

  • 640x480:
      javascript:void(window.resizeTo(640,480))
  • 800x600:
      javascript:void(window.resizeTo(800,600))
  • 1024x768:
      javascript:void(window.resizeTo(1024,768))
(just drag any of these to your toolbar!) There are also favelets to validate the current page, list all stylesheets, list style rules, view images, etc. Some work only in Mac IE 5, but many work in Windows as well. Some, like the reSizeTo() favelets, also work in Mozilla/Netscape. There're also links to other pages of favelets. BTW, some favelets which don't work in Windows IE from the personal toolbar *will* work if accessed from within an HTML page. Enjoy! ;-p

Web Maestro Clay p.s. These window resizers also work in Windows Explorer, although you have to hit the [Back] button after clicking them.

---
Father of Jeremy Logan Leeds

[ Reply to This | # ]

"Favelets"
Authored by: googoo on Mar 26, '03 11:26:51AM

You have an error in the 1024x768 javascript code. Replace the "x" with a comma, and it will work. Try this link:

  • 1024x768
    javascript:void(window.resizeTo(1024,768))

PS: Great hint, though! Thanks.



[ Reply to This | # ]
"Favelets"
Authored by: bluehz on Mar 26, '03 01:08:45PM

Couple of other nice favelet (aka bookmarkets) sites:

http://www.bookmarklets.com/tools/categor.html
http://www.squarefree.com/bookmarklets/
http://www.webreference.com/js/column35/



[ Reply to This | # ]
Mailing Safari URLs via Mail BROKEN in Panther
Authored by: stevec on Oct 29, '03 08:35:15AM

This seems to have broken in Panther, anyone have a clue how to fix it?



[ Reply to This | # ]
Mailing Safari URLs via Mail BROKEN in Panther
Authored by: alajuela on Dec 13, '04 11:03:13AM

Um, not for me.



[ Reply to This | # ]
Mailing Safari URLs: one more adjustment
Authored by: dashard on Mar 26, '03 10:31:33AM
OK, I know, this hint has legs but MUST BE STOPPED! For those of you who like this but don't like having to add yourself to the 'To:' field in your mail client, adjust the script simply by replacing 'YOUR_EMAIL_HERE' with your email address. Make sure to leave the question mark (?) in place:
javascript:location.href='mailto:YOUR_EMAIL_HERE?SUBJECT=
  '+document.title+'&BODY='+escape(location.href)
[robg adds: I edited this post to add a line break -- do NOT enter the line break when adding this shortcut, and do not add any spaces between the equal sign and the single-quote on the next line. I broke the line to make the story wrap in a more browser-friendly manner.]

It will arrive in your mail client pre-addressed. For me, the only general use I would have for this is to send to my home address when I'm at work, and my work address when I'm at home. Add the address to the javascript and all you have to do is hit 'Send.' FWIW.

[ Reply to This | # ]
Mailing Safari URLs via Mail - revisited
Authored by: nite77 on Mar 26, '03 12:10:46PM

btw, if nobody has noticed it, it works on Camino too. (the mailing of URLs, I mean)

---
/Nite - "can't rain all the time"
[ http://www.nitesade.net ]



[ Reply to This | # ]
Mailing Safari URLs via Mail - revisited
Authored by: diZZy on Mar 26, '03 01:42:25PM

Hmm... In Camino, just select from the Menu --> File --> Send Link



[ Reply to This | # ]
Mailing Safari URLs via Mail - revisited
Authored by: RandyMan on Mar 26, '03 03:18:18PM

Make a slight change by adding angle brackets after the "BODY=" and a the very end and you've got a URL that will work in all major and sub-major email clients when the URL spans multiple lines!

[I tried to actually show this in this reply, but I was unable to figure out how to get the angle brackets to be interpreted literally instead of being thought of as part of the HTML. Sorry.]



[ Reply to This | # ]
Mailing Safari URLs via Mail - revisited
Authored by: lrivers on Mar 26, '03 04:12:32PM
javascript:location.href='mailto:?SUBJECT='+document.title+'&BODY="

WIth the angle brackets to avoid breaking long URLs

Get angle brackets to show up by using the HTML code for them, e.g. > & <



[ Reply to This | # ]
Use the [ code ] tags...
Authored by: robg on Mar 26, '03 05:28:34PM
The only reliable way to get the brackets (and the backslash) in Geeklog is to use the new [ code ] / [ /code ] tag pair (without the spaces). Then you can just type them in as you normally would.

The method with the HTML entities works, but each time you hit Preview, the entities are converted to the real characters in the input area, so you have to remember to convert them back AND not to hit Preview before the last Submit :-(.

So just use [ code ] instead:
javascript:location.href='mailto:?SUBJECT='+document.title+
  '&BODY=<'+escape(location.href)+'>'
I think that's what everyone was trying to write, correct?

-rob.

[ Reply to This | # ]
Mailing Safari URLs via Mail - revisited
Authored by: luhmann on Mar 27, '03 11:14:48AM

I used to have a javascript in Camino that allows one to actually e-mail selected text as well as the URL - without the extra copy-paste. however, this never worked in Safari. I found that, and many more such hints here:

http://www.bookmarklets.com/



[ Reply to This | # ]
Mailing Safari URLs via Mail - revisited - FTP?
Authored by: barryjaylevine on Mar 27, '03 05:13:39PM

Doesn't seem to work for URL's that begin with "ftp". Any solution would be appreciated.

Post 'em if you got 'em. ;-)

Barry



[ Reply to This | # ]
Converting script to Make TinyURL!
Authored by: LouieNet on Jan 15, '04 09:27:35PM
When I tried converting the javascript to send a URL to TinyURL for conversion, I found that it sent the colon as %3A, and TinyURL wasn't able to parse it as a colon. Then I managed to find that on the homepage, it already lists the right code to use:
javascript:void(location.href='http://tinyurl.com/create.php?url='+location.href)
Now, you make a smaller URL before emailing it out! :)

Louie

---
G4 cube, 1152M RAM, OS X Server 10.2.8
17" Powerbook G4, 1G RAM, OS X 10.2.8

[ Reply to This | # ]

Mailing Safari URLs via Mail - revisited
Authored by: larryh123 on Aug 28, '04 05:14:24PM
I love the Mailto hotkey hint, but now there are more and more problems with the URLs it captures. Here is an example. If I am at this page:
 http://forum.spamcop.net/forums/index.php?showtopic=2009&st=0&#entry13334
the URL inserted in the new mail message is:
 http://forum.spamcop.net/forums/index.php?showtopic=2009
This happens a lot on commercial news sites, too. It is pretty obvious that the problem is the ampersand, a significant character to javascript. Seems like the javascript string() function may be able to help, but I am not enough of a javascript guy to fix it. I hope somebody else can.

[ Reply to This | # ]
Mailing Safari URLs via Mail - revisited
Authored by: qoo77 on Mar 31, '05 10:29:42PM
works for me when i use this....

javascript:location.href='mailto:?SUBJECT='+document.title+'&BODY='+document .title+'%5Cr%3C'+escape(location.href)+'%3E'

[ Reply to This | # ]

Mailing Safari URLs via Mail - revisited
Authored by: Elisabet Frazer on Sep 06, '05 06:18:59PM

This script doesn't work for me in Safari 1.3 and MAC OS X 10.3.9. The first version worked great for simple URLs at least.



[ Reply to This | # ]
Mailing Safari URLs via Mail - revisited
Authored by: alajuela on Jul 17, '07 01:54:38PM

Had to post, since I still use this hint, even though Safari pretty much does all this under the File menu now. Posting only to note that having this in your Bookmarks bar works on the iPhone. Yes, you can tap the Share button, but it was fun to discover that this still works.



[ Reply to This | # ]