FOAF Autodiscovery Bookmarklet

There are a few web applications available for displaying FOAF files in a human-friendly format. For example there’s FOAF Web View, FOAFnaut, and FOAF Explorer.
A number of folk have also started using FOAF autodiscovery to LINK to their own FOAF descriptions. This uses the same principle as RSS autodiscovery.
I thought that it’d be useful to tie these together, and create a FOAF autodiscovery bookmarklet. So, here’s a first crack at it.
Drag the following to your toolbar: <a href="javascript:void(d=document);void(el=d.getElementsByTagName('link'));for(i=0;iFOAF Explorer.
You should now be able to click that link and be automatically routed to FOAF Explorer if the current page references a FOAF description in the correct way.
This page has one, as does hackdiary, Semantic Weblog, and dive into mark to name but a few.
I have encountered some problems with the bookmarklet in Mozilla 1.0, although the same pages work fine in IE 5. If there are any javascript experts out there I’d appreciate a pointer or two if you can see anything wrong with the code.. Morten Frederikson has fixed the bookmarklet and incorporated it into FOAF Explorer, so the bookmarklet should now work in all browsers. The link is basically just a hacked version of Mark Pilgrim’s RSS autodisovery bookmarklet, with the addition of a check for relative FOAF file locations as sported by Internet Alchemy. A quick test of the original RSS bookmarklet showed the same problem, so hopefully its not just me being dull (but don’t rule it out).
Thats my sad friday night tinkering done with for another week!

7 thoughts on “FOAF Autodiscovery Bookmarklet

  1. Cool!
    It nearly had me for a minute – nothing happened – but then I realised I was on the permalink page, not your front page.
    (My oh my you’re productive!)

  2. Mmmm, yes I should update my templates so that my FOAF description is linked from more than just the home page.
    For RSS autodiscovery, it ONLY makes sense to have it on the main site entry point, as its essentially pointing to an alternate version of that page. Archive auto-discovery links ought to be to feeds for that archive entry (+comments).
    However for FOAF is makes sense to make information about me available in multiple locations on the site, so its always available.
    Not sure that my productivity is that high though!

  3. It doesn’t work on my page, and looking at the code I can’t find why.
    Anyway, I’ll check it later again to see where’s the problem.

  4. Assuming that is “your page” I can tell you why its not working. Its because you don’t have autodiscovery set up in your page correctly.
    You need the following in the <head> tag in your page:
    <link rel=”meta” type=”application/rdf+xml” title=”FOAF” href=”” />
    I see that you’ve added the title and type links to the <a/> tag used to link from the FOAF icon on that page, but this is incorrect. You need to add a <link/> tag — this is what the bookmarklet is looking for with this DOM method call:
    Hope that helps,

  5. Hey, you’re right! I haven’t updated my page yet, but you’re right about why is not working.

  6. FOAF Autocreation

    FOAF Autocreation The FOAF autocreation script takes two links – one to your current FOAF file and one to your

Comments are closed.