WordPress Bookmarklet on Safari 3.1

Wow. Err, Cool. I’m impressed with myself.

OK, let’s backtrack a bit…

When I’m using Firefox, if I see something on a webpage that I want to blog about, I generally use the ScribeFire extension. This pops up a box in the lower half of the window, with a link to the page in question already filled in. I have it configured to save what I post as a draft, so I can tidy it up in WordPress before publishing it.

But that’s not going to work on Safari. But never mind, WordPress 2.3.3 provides a little Bookmarklet – basically a link containing some JavaScript that you can drag to your Bookmark bar. Highlight some text on a page, click the link and you’ll be taken to your WordPress Write page. The page title will be filled in as the post title and the link and any highlighted text will be already in the text box, ready for you to finish the post and publish it.

The only trouble is that the code doesn’t do what I really want – on Safari, it opens the Write page in the current tab – the one with the document I want to write about, which rather defeats the object of the exercise, as I would generally want to refer back to the original page while I’m working on the post.

So I did some googling and reading, and found a suggestion that looked like it might work. What I needed to do was use a different JavaScript command. Instead of


I should use


Well, I gave it a try, and after a few false starts and typos, I had a new bookmarklet which actually works.

This is the code, should you want to make your own:


The whole thing needs to be on one line. You’d need to put your own site address in there in place of “example.com”, of course, and if your blog isn’t in /wordpress, edit that bit, too. Then all you have to do is make that the target of a new bookmark – you might find it easier to drag the WordPress Bookmarklet from the bottom of the Write page to your bookmark bar, then edit it to match.

This has only been tested on Safari 3.1 on Mac OS X 10.5.2. No guarantees are offered, and if it doesn’t work for you, I probably won’t have a clue why. But for me, it opens a new tab, ready for me to post into, and I’m quite happy with that.