History Navigation

The Ajax File Browser provides support for navigating through browsing history. When user navigates the tree structure, by default, the history is automatically saved on a client side. You can use Back and Forward web browser buttons to go through the history, just like in a desktop file manager.

In a web browser URL bar, you can notice the hash, identical to your current location is added to the URL when going from the folder to folder:

The hash, identical to your current location, is added to the web browser URL

This hash is required to hook web browser history buttons.

In case you need to disable history navigation, set the Settings.EnableHistoryNavigation property to false

When browser is being created, by default, it automatically extracts hash from the URL and navigates to the path specified in the hash. This action is similar to specifying Settings.SelectedFolder property or calling SetSelectedFolder method. If you wish to disable this functionality, you can set the Settings.OpenHistoryLink to false.

See the example below:

var settings = {
    Id: 'AjaxFileBrowserContainer',     // ID of the HTML control in which Ajax File Browser will be created
    Url: webDavServerPath,              // the root folder to be displyed in Ajax File browser
    Style: 'height: 100%; width: 100%', // always provide size of the control
    FileIconsPath: '/icons/',           // path to the folder where file icons are located
    MsOfficeTemplatesPath: webDavServerPath + '/templates/', // path to MS Office templates, always specify full path
    SelectedFolder: webDavServerPath,                        // folder to be selected, same as SetSelectedFolder call
    EnableHistoryNavigation: true,                           // hooks web browser history buttons to tree navigation
    OpenHistoryLink: false,                                  // extract hash from URL and navigate to the folder specified in it
    PluginsPath: '/plugins/'                                 // path to Java applet for opening documents in FF, Chrome and Safari
};


var ajaxFileBrowser = new ITHit.WebDAV.Client.AjaxFileBrowser.Controller(settings);

Next Article:

AJAX File Browser Settings Object Reference