How I did the bookmarklet

I just posted a link to the test version of Fargo 1.51 which has support for linkblogging, and support for the bookmarklet that we discussed on Scripting News last week.

Now that it’s out there I can show you how I did it.

The intermediate app

The trick is this — the bookmarklet calls an app running in a web page on fargo.io.

This is where the app is: http://fargo.io/misc/bookmarklet/.

Here’s a screen shot of the source of the app.

Because that app comes from the same domain as the Fargo app, when they’re running on your machine they share a local storage namespace.

The app writes the query string to localStorage.fargoSearchString, and it quits.

Once a second, Fargo looks for localStorage.fargoSearchString. When it shows up, it copies it, deletes it, and then parses it, and adds the link to the designated linkblog outline.

Why it works

We just communicated with a running app without having to relaunch it. Which of course with a major piece of software like Fargo is a fairly big deal — far too much work to do for a single link. But the intermediate app is just a few lines of text. No big deal loading it just to send a message to Fargo.

Advertisements

About Dave Winer

Dave Winer, 54, pioneered the development of weblogs, syndication (RSS), podcasting, outlining, and web content management software; former contributing editor at Wired Magazine, research fellow at Harvard Law School, entrepreneur, and investor in web media companies. A native New Yorker, he received a Master's in Computer Science from the University of Wisconsin, a Bachelor's in Mathematics from Tulane University and currently lives in Berkeley, California.
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s