behavior:history

This behavior provides navigation history support, close to what browsers do on go-back go-forward buttons clicks.

Elements

<frame history> - standard frame element but with attribute history defined.

Model

This bevavior is applicable to any elements containing frames inside. For example it can be applied to <frameset> if needed.

Attributes

behavior:history is not using any specific attributes.  

Methods

canGoBack
( ) : true | false,  true if history is available and method goBack() will be successful.
canGoForward
( ) : true | false,  true if forward state(s) are available and method goForward() will be successful.
goBack
( ) : true | false,  goes back on navigational stack, returns true if navigation was successful.
goForward
( ) : true | false,  goes forward on navigational stack, returns true if navigation was successful.

States

N/A

Events

The behavior generates the following event:

HISTORY_STATE_CHANGED
- generated when state of internal navigation stack is changed.

The behavior reacts on the following events:

HISTORY_PUSH
- posted on hyperlink navigations and load new content handling by behavior:frame.
HISTORY_PRIOR
- the behavior will handle the event by calling goBack() method.
HISTORY_NEXT
- the behavior will handle the event by calling goForward() method.

Value

N/A

History state change handling in script

raw onControlEvent handler
var edit = $(input#some);
edit.onControlEvent = function(evt)
{
  switch(evt.type) {
    case Event.HISTORY_STATE_CHANGED: 
       /* evt.target is the element */ 
       break;
  }
}

decorators.tis handler

include "decorators.tis";

@when Event.HISTORY_STATE_CHANGED @on "frame#content" 
   function() {
     ... event handling code ...;
   }