javascript bookmarklets not working

I use 1 line javascript bookmarklets.
They have the code %5Cn which used to send a carriage return, line feed so that I could have some text on 1 line, and the rest on a new line. But that does not work anymore. Everything is on the same line since updating to Safari 3.0.4.

I also tried using %5Cn%5Cr which should put a new line, carriage return. It did not make any difference.

What else could I try?

MBP 15 CD, MBP C2D 17; TiBook, G4 MP500; iMac Grape, Orange, Classic II, PB180C, Mac OS X (10.5.6), 60G iPod Photo, 4G nano, 8G iPhone, 1G shuffle

Posted on Jan 29, 2009 10:57 PM

Reply
14 replies

Feb 1, 2009 1:12 PM in response to iBod

It works perfectly. Thank you.

Now I will just add email addresses and I have a very quick way to send URLs to certain people. They will then have the title and subject in the email. I like this better than the way Safari does it from the file menu.

Why did the old way of doing it stop working? Did Javascript change, did Safari change, or something else changed? I also had other scripts that stopped working. Some of them were just for fun, but some were useful. (The mail was the most useful). I can understand them, but I don't know enough to write them. I got most of them from websites.

Feb 1, 2009 1:16 PM in response to Judy

Hi Judy,

Why did the old way of doing it stop working?


To be honest, I have no idea. I'm not on a Mac at the moment so was testing with Firefox. Firefox was also not placing the address on a new line. It may have been a bug in Safari that was fixed and broke the behaviour you expected. That's a complete guess though 🙂

Feb 1, 2009 5:52 PM in response to iBod

I now tried using more than 1 email address. So instead of just

'mailto:?

I used 'mailto:name1@xxx.com,name2@xxx.com?

It works ok for 1 or2 names. If I use 3 or more names, then either the emails get messed up and/or the subject is not right.

What is the right way to enter several email addresses?

Feb 1, 2009 6:21 PM in response to Judy

I don't believe there is any 'official' way to specify more than one address. Support seems to depend from client to client.

You may have more success using cc. E.g.:

javascript:location.href='mailto:a@test.com?cc=b@test.com&cc=c@test.com&SUBJECT= ' document.title+'&BODY='+document.title+encodeURIComponent('nn%20%20%20%3C'+locat ion.href'%3E')

Feb 13, 2009 3:29 AM in response to Judy

Hello again Judy,

That page you posted has an ampersand (&) in the title which is a reserved character and needs to be escaped. Give this a try (seems to work for me):

javascript:location.href='mailto:a@test.com?cc=b@test.com&cc=c@test.com&SUBJECT= '+ escape(document.title )\ '&BODY=' escape(document.title ) encodeURIComponent('nn%20%20%20%3C'+location.href'%3E')

Edit: For anyone else reading, that's supposed to be a single line but the forum is wrapping the line strangely...

Feb 13, 2009 4:19 AM in response to Judy

Hi Judy,

Will this take care of all special characters that may show up in a title?


It should do (I hope)

Can you recommend a good book for learning JavaScript, especially things like this?


I'm afraid I tend to use online resources rather than a book. Amazon might have some good rankings to figure which books might be worth investigated further. I probably go to this site more often than not, but usually I just go where Google guides me to 🙂

http://www.w3schools.com/JS/default.asp

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

javascript bookmarklets not working

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.