help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-smalltalk] [Iliad] Bookmarking AJAX actions and fixing the back/fo


From: Nicolas Petton
Subject: [Help-smalltalk] [Iliad] Bookmarking AJAX actions and fixing the back/forward buttons
Date: Mon, 17 Aug 2009 11:19:15 +0200

Hi,

There is a new feature in recent versions of Iliad which allows you to
bookmark your AJAX app, using the hash (fragment) of the url - the hash
is the part after the #.

How to use it:

There are two steps to do it.

STEP ONE: Each anchor action can be associated with a hash parameter
with #action:hash:

For instance, in a blog app, you could write something like this:

e anchor
        action: [self showComments]
        hash: 'showComments'.

the action will be evaluated normally, but in addition the hash will be
added to the url.

STEP TWO: The next step is to retreive the state from the url, to update
state from normal requests too (when you give a link to someone or
refresh the page for example).

There is now a new route dedicated to the hash path, available in
Application>>hashRoute

You can use it like every other route:

self hashRoute next = 'showComments' ifTrue: [self showComments].

That's all!

This way, bookmarking AJAX state becomes easy, and you still think of
your control flow in term of actions.

Also, it will add entries to the history; so the back button will work
for your ajax apps :)

Best of all, it will continue to work without javascript enabled, like
Iliad did before, making normal requests, and just not using the hash.  

There is one drawback: the back button doesn't work for IE < 8 yet. I
still have to add a hack to iliad.js, but this will work too eventually.

Also, please note that this is very young code and may change in the
near future.

Cheers and sorry for the long post,

Nico

Attachment: signature.asc
Description: Ceci est une partie de message numériquement signée


reply via email to

[Prev in Thread] Current Thread [Next in Thread]