Partager via


About Web Folder Behaviors

This topic documents a feature of Binary Behaviors, which are obsolete as of Internet Explorer 10.

The Web Folder Behaviors available as of Microsoft Internet Explorer 5 and later allow users to navigate to a folder view, and include support for Distributed Authoring and Versioning (DAV) and Web Extender Client (WEC) protocols. DAV is a series of extensions to the http and defines how basic file functions, such as copy, move, delete, and create folder, are performed across http. WEC is a Microsoft FrontPage protocol that provides the same sort of functionality as DAV, in addition to its own value-added FrontPage features. Both protocols define how to set and retrieve properties on http resources.

The Web Folder Behaviors enable authors to view sites in a Web folder view, which is similar to the Windows Explorer folder view. The DAV and WEC protocols add additional capabilities to the Web folder view. For example, using the Web Folder Behaviors and DAV makes it possible to perform the equivalent of a DIR command on an http resource and retrieve all the information necessary to fill a Windows Explorer view. Internet Explorer 5 and later supports two Web Folder Behaviors that allow users to browse sites in a Web folder view.

The anchorClick and httpFolder Web Folder Behaviors encompass the means to navigate from a Web page to a Web folder view. They provide convenient access to folders and files on an http server. A Web folder view maintains a consistent user experience between navigating the local file system, a networked drive, and an Internet Web site. Although a Web folder is a part of the file system hierarchy, it does not necessarily represent anything in the file system.

  • Benefits of Web Folder Behaviors 
  • Implementing Web Folder Behaviors 
  • Related Topics

Benefits of Web Folder Behaviors

The Web Folder Behaviors provide an easy way to view files and folders on an http server for anyone using Internet Explorer 5 or later. In addition, script authors are empowered with a robust implementation that exposes any HTML object to the Web folder navigation abilities of the Web Folder Behaviors, while delivering to authors the extensibility for designing their own interface. Some of the advantages of using Web Folder Behaviors are:

  • Anyone with Internet Explorer 5 or later can open a Web folder with no script and no fuss.
  • Internet service providers (ISPs) can provide Web page clients with easy file and folder access to their content.
  • Authors can access their content in Web folder view while maintaining control over the look and handling of the Web Folder Behaviors.

Implementing Web Folder Behaviors

The anchorClick behavior is the quickest way to open a Web folder in Internet Explorer 5 and later. This behavior requires a STYLE definition using the anchorClick behavior, an HTML element, and the FOLDER attribute. If the FOLDER attribute is not set when using the anchorClick behavior, the HREF attribute on the anchor will be used as normal.

Copy the following code and paste it into a Web page.

<style>
a {behavior: url(#default#AnchorClick);}
</style>

<a href = "https://your_server.com/your_directory/your_file.htm"
folder = "https://your_server.com/your_directory/"
target = "_top"
>
Open in Web Folder View
</a>

The FOLDER attribute specifies the location of the Web folder the anchor will open. Frames and windows can be specified using the TARGET attribute. The anchorClick behavior requires no additional actions on the part of the author other than adding the behavior in the STYLE element, and adding the FOLDER attribute to the anchorClick behavior. When using the anchorClick behavior, keep the following in mind.

  • Clicking the A object opens the address specified in the FOLDER attribute in Web folder view.
  • The value of the FOLDER attribute is displayed when the mouse pointer moves over the A.
  • Downlevel browsers can display the value of the HREF property in the status bar or as a title, so the file name and the contents of the downlevel file are important to keep in mind.
  • Downlevel browsers proceed to open the address specified by the HREF attribute.
  • For this behavior to work, the Web Folders component of Windows Internet Explorer must be installed. If the component is not installed and the behavior is invoked, Internet Explorer prompts the user to download the component. To open a Web address in folder view, the Web server must include a WebDAV server, available as of Microsoft Internet Information Services (IIS) 5.0, or support WEC extensions, available as of FrontPage 2000.

Script authors can navigate to a folder view using any object that is participating in the httpFolder behavior. The navigate and navigateFrame methods exposed to the httpFolder behavior provide Web folder view functionality through script. Responsibility for the interface and error handling is presented to the author, providing a means for creative implementation of the behavior and the navigate and navigateFrame methods.

These two methods provide similar functionality. The navigateFrame method allows an author to specify the address and the window or frame to use. This method has the following syntax:

oDAV.navigateFrame(sURL,sTarget)

where:

  • oDAV specifies the object participating in the httpFolder behavior.
  • sURL specifies a valid Web site address using the http or https protocol.
  • sTarget specifies _self for the current window, _blank for a new window, or the name of a window or frame.

The following sample implementation opens the arbitrary address "https://www.your_server.com/your_directory/" in Web folder view using the current window.

oDAV.navigateFrame("https://www.your_server.com/your_directory/","_self");

The navigate method is equivalent to navigateFrame(sURL, "_self"), where the sTarget parameter is equal to _self.

Implementing the httpFolder behavior requires a STYLE definition, any HTML object participating in the httpFolder behavior, and script to handle the navigation request, as shown in the following example.

<!-- The httpFolder class enables the Web Folder behavior. -->
<style>
.httpFolder {behavior: url(#default#httpFolder);}
</style>

<!-- The fnOpenFolderView function navigates to Web folder view. -->
<script>
function fnOpenFolderView(){
    oDAV.navigateFrame("https://sample.microsoft.com","_self");
}
</script>

<!-- The div tag is an arbitrary object -->
<div
   id = "oDAV"
   class = "httpFolder"
/>

<!-- The input object calls the fnOpenFolderView function -->
<input
   type = "button"
   value = "Open Folder View"
   onclick = "fnOpenFolderView()"
>