bookmarklet implementation notes

12 Jan

A colleague asked me about bookmarklets with TiddlyWeb, based on my
Scrumptious bookmarklet.

Yeah I did some bookmark stuff in my contrib dir, lib/trails/static
stuff. There are certainly some interesting challenges, e.g. getting
the URL right which your comments helped about using a variable with
the templates/ concept.

I made things complicated by using a modal interface and iframe, but
if you can avoid that it’s a lot simpler. In the simple case, the
bookmarklet code would create an iframe to a page on the tiddlyweb
domain, passing in any parameters/data on the URL. Then it can save
them to tweb. The hard part is how does the iframe close itself?!! I’m
not aware of any clean solution, so you have to do some kind of
cross-domain iframe messaging, or you can cheat by just reloading the
parent page. There’s a jQuery plugin by @cowboy to
do iframe messaging.

A much simpler solution is a popup window, where again you pass info
on the command-line. The advantage is simplicity: no layout hassle, it
can close itself easily too. Also, it’s better from a trust/security
perspective as you’re not asking users to login via iframe, which is
teaching them to be phished. However, UX isn’t as nice; I guess you
could supplement it with a browser extension later if you wanted.


Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s

%d bloggers like this: