Available elements


There are multiple ways to use links with WebApp.Net. The most basic way is the classic HTML definition to jump to another web page.

[a href="MyPage.html"]Go to next page[/a]

The main problem with this kind of link is that the whole document will be loaded and the latency can be long depending on the used network (WiFI, EDGE, ...). To get rid of this problem, WebApp.Net provide some new features to ease user experience.

Sliding effect

WebApp.Net uses a layer based document. This means that you can easily navigate from one layer to another part of the document without loading a new page like with simple anchor, but in a good looking fashion. See Getting start for a sample code using the sliding effect.

[a href="#_Next"]Go to next layer[/a]

This tells WebApp.Net to switch to the layer named waNext (see Layer section for details). The screen will then "slide" from the current layer to the destination layer.

Asynchronous link

The best way to limit the amount of data required by a document is to load asynchronously parts of this document. To achieve this use the following delcaration:

[a href="MyPart.php?zone=something&id=5" rev="async"]Load content[/a]

The rev="async" attribute tell the micro-framework that this link must be loaded asynchronously. WebApp.Net will then request the href URL and retreive the content which must be in the format exposed in XML Format.

With this link, nothing seems to append unless the part to render is in the active layer or the response include the <go> element to go to the layer which owns the part to render. If you want, you can add the destination layer in the URL.

[a href="MyPart.php?zone=something&id=5#_Next" rev="async"]Load and go to layer[/a]

The resulting URL in the address bar of the browser will be the current URL before the request along with the request parameters value. For instance, if the current URL is http://my.site.com/index.html, the resulting URL will be:

URL: http://my.site.com/index.html#_Next/something/5

Parameters are kept to allow layer bookmarks. This is explain in details in the Advanced features.

You can of course disable this behavior by using async:np (no parameters) but this will not work if you define a <go> element in the XML response. Since you can define any destination you want, it will not be overriden by the micro-framework.

[a href="MyPart.php?zone=something&id=5#_Next" rev="async:np"]Load and go to layer[/a]

Working with URL rewriting

TODO (using [go/] instead of query string params)

Simple anchor

WebApp.Net uses HTML anchors to navigate between layers, but as long as your anchor doesn't start with #_, it will be considered as a simple anchor. Anyway, usage of anchors is discouraged since it can lead to weird behavior.

Saturday, 20-Jun-2009 14:40:34 CEST