BrT

Musings about technology and other neat stuff

BrT random header image

del.icio.us tagging using browser keywords

August 7th, 2005 · 12 Comments

(see Update below!)

For a while, I have assigned a keyword to the del.icio.us bookmarklet. I use Sogudi in Safari for this, but the same feature exists in pretty much any other browser. With the default bookmarklet, I had assigned the keyword “dl” to it, so when viewing a web page, I can just press Command-L, type “dl”, press Enter, enter tags, press “Save”, and it saves the bookmark and takes me back to the page.

This trick by Fraser Speirs inspired me to try and improve this technique. I have now slightly modified the bookmarklet so I can enter the tags I want directly after the keyword. This is the content of the bookmark (make sure it’s all in a single line and without spaces):


javascript:location.href='http://del.icio.us/new/zzamboni?v=2&url='
+encodeURIComponent(location.href)+'&title='+
encodeURIComponent(document.title)+'&tags='+
encodeURIComponent('@@@')

The “@@@” is the special string that tells Sogudi to insert there the text typed after the keyword (for Firefox and Mozilla, use “%s” – I’m not sure for Opera). After this is saved, you can type “dl tag1 tag2 tag3″ and the tags field will be pre-filled, you can just press the “save” button.

For automatically posting the URL, without going through the form, you can use this bookmark:


javascript:location.href='http://username:password@del.icio.us/api/posts/add?url='
+encodeURIComponent(location.href)+'&description='
+encodeURIComponent(document.title)+'&tags='+
encodeURIComponent('@@@')

Don’t forget to set your username and password in there. This has the disadvantage of showing you the XML result page instead of sending you back to the page.

I think this should also work with QuickSilver, but for now, when I define a bookmark with the special “\*\*\*” in it and use it as a search in QS, it does not send it to Safari – only if I do “Run Javascript” on it, but then I don’t get to give it the tags. Maybe I’ll keep investigating this, although I’m perfectly happy about doing this from the browser.

Final version

Update: Using this improved bookmarklet as a base, I have a new one: if you provide tags, it will automatically add the URL, but if you don’t, it will take you to the input form. It still will use the selected text, if any, as the extended description (unfortunately this does not work in Safari, as it unselects the text when you move to the location bar – bummer). Here are the bookmarklets:

In any case, you have to edit the bookmark and replace the string CHANGEME with your del.icio.us username. Here is the code (for the Firefox version), in case you want to cut and paste (make sure you put it all in a single line):


javascript:u='CHANGEME';t='%s';q=location.href;e = '' +
(window.getSelection ? window.getSelection() : document.getSelection ?
document.getSelection() : document.selection.createRange().text);
p=document.title;window.location.href=(t!='%'+'s')?'http://del.icio.us/'+
u+'?tags='+escape(t)+'&url='+escape(q)+'&description='+
escape(p)+ '&extended=' + escape(e):'http://del.icio.us/'+u+
'?v=2&url='+escape(q)+'&title='+escape(p)+
'&extended='+escape(e);

Thanks to John Resig for the improved code!

Tags:

12 responses so far ↓

  • 1 John Resig // Aug 7, 2005 at 10:45 pm

    Super-Fast Delicious Bookmarklet

    Today I noticed that Chris Lott was looking for a super-fast way to post to del.icio.us after having posted a link to this bookmarklet on his del.icio.us link page.

    The bookmarklet provides the following functionality:

    The ability to type ‘d tag…

  • 2  Daniel Schildt // Aug 9, 2005 at 1:48 pm

    Thanks much for the improved version of improved version of your bookmarklet. ;)

    Works well and makes using del.icio.us much faster and easier.

  • 3  BillSaysThis // Aug 10, 2005 at 12:48 am

    Having similar problem with the improved version. When typing d tag… Firefox apparently triggers a quick search to digg.com in a new tab even though I don’t have a quicksearch bookmark or search box extension for that site (I have used it). I have Tab Mix Plus extension installed but turned off the new tab from location bar option.

  • 4 HARALD MARTIN STRÖM » Blog Archive » Fast del.icio.us-poster bookmarklet // Aug 12, 2005 at 12:57 am

    [...] I took Hitchhiker’s Sogudi shortcut and modified it to use a JavaScript-prompt() to ask for the tags. Use it in Safari as the first bookmark or so and activate it by pressing cmd + 1 (or other number depend on where on the bookmark bar it is) [...]

  • 5  Hitchhiker // Aug 13, 2005 at 11:08 pm

    BillSaysThis: just to ask the obvious, have you defined the “d” keyword for the bookmarklet?

  • 6  Marco // Oct 7, 2005 at 3:30 am

    You can use the bookmarklet in AcidSearch (a very powerful add-on for your search bar), as well.

    Just delete the “@@@” from the Sogudi bookmarklet, and split the code right at the point where the first @ was (see below). Open double brackets, {{ at the beginning of the “Prefix URL” part, and close them at the end of the “Suffix URL.” Then, swap CHANGEME with your del.icio.us username, and select a shortcut for it.

    Before:
    javascript:u=’CHANGEME’;t=’@@@’;q=location.href;[cut for brevity]encodeURIComponent(e);

    After:
    Prefix URL:
    {{u=’CHANGEME’;t=’ –don’t close brackets here!

    Suffix URL:
    ‘;q=location.href;[cut for brevity]encodeURIComponent(e);}} –close’em here!

    I hope that was clear enough… :P

  • 7 yup » Flocker and delicious+bookmarklets // Nov 5, 2005 at 12:43 am

    [...] del.icio.us tagging using browser keywords [...]

  • 8  Geodog // Nov 26, 2005 at 7:15 am

    This recently stopped working for me. Any idea why?

  • 9  Hitchhiker // May 7, 2006 at 10:55 pm

    Geodog – what stopped working? I just updated the bookmarklet, maybe this will fix it?

  • 10  Tom Clancy // Jun 27, 2006 at 9:30 pm

    Yeah, it just stopped working for me as of this afternoon (it was fine this morning). Whenever I try, I get:

    “A required security token was not received with your form data.” I’m guessing they’re now requiring a password?

  • 11  britta gustafson // Jul 26, 2006 at 10:18 pm

    Here’s an explanation of why this doesn’t work anymore: http://groups.yahoo.com/group/ydn-delicious/message/296

  • 12 del.icio.us tagging using browser keywords « llbbl // May 9, 2008 at 1:50 pm

    [...] 9, 2008 del.icio.us tagging using browser keywords With the default bookmarklet, I had assigned the keyword “dl” to it, so when viewing a web [...]