Script Loading

Script Loading

When IWML encounters a custom control tag it will attempt to load it as described here.

The Parts

IWML custom controls exist in two parts, a namespace prefix and control name. For example:

SmileyControl.Smiley

SmileyControl is the namespace prefix, and Smiley is the control name. The full demo and tutorial of SmileyControl is available online.

All controls must exist as a sub namespace of IntraWeb.Controls. For smiley, this means IntraWeb.Controls.SmileyControl.Smiley.

Controls can exist in any .js file, however to enable auto loading the filename must be <namespace prefix>.js. In this example it would be SmileyControl.js.

Finding the Control

If a step is successful in finding a matching control, further steps will not be attempted.

1 – Search Loaded Controls

First IntraWeb will search existing controls already loaded. This allows IntraWeb to find internal controls, but also controls that have already been loaded either implicitly by IntraWeb or explicitly by user code.

2 – Try to Load from Loadable Path

From the IntraWeb library path and from within a Loadable sub directory, see if <namespace prefix>.js exists and load it if so. In this example it would be Loadable/SmileyControl.js.

For a control being redistributed this is the best option which makes it available to all applications.

3 – Try to Load from .IWML Path

Look for <namespace prefix>.js in the same path as the .iwml file that contains the tag.

This option allows local deployment of a custom control within an individual application.