Loading the Windows Live Messenger Web Toolkit

The Windows Live Messenger Web Toolkit components are loaded with the Microsoft.Live.Core.Loader class. The loader is required to load the Windows Live Messenger UI Controls.

We recommend using the loader for all Windows Live Messenger Web Toolkit components, including the Windows Live Messenger Library.

To use the Windows Live Messenger Web Toolkit, an application first loads the following file: http://www.wlmessenger.net/api/3.7/loader.js. The application then calls the loader to load the Windows Live Messenger Web Toolkit components. For example, to load only the Windows Live Messenger Library, load the messenger.core component.

The following code example shows how to load the Windows Live Messenger UI Components with the default styles, by loading the Messenger.UI.Styles.Core and Messenger.UI components.

<script type="text/javascript" src="http://www.wlmessenger.net/api/3.7/loader.js"></script>
<script type="text/javascript">
Microsoft.Live.Core.Loader.load(['Messenger.UI.Styles.Core', 'Messenger.UI'], null);

The loader is a general-purpose script loader. It loads scripts asynchronously to minimize the effect on page load time. The loader determines dependencies between scripts to load them in parallel when possible.

Applications can load their own scripts by using the loader. An application adds its own script components for use with the loader with the AddScript function. For example, the following code example loads JQuery along with the Windows Live Messenger Toolkit from the same URL path as the file that is calling the loader.

Microsoft.Live.Core.Loader.addScript('jquery', 'JQuery.js');
Microsoft.Live.Core.Loader.load(['jquery', 'Messenger.UI.Styles.Core', 'Messenger.UI'], null);

Applications can use the loader to delay load scripts until a specific time—for example, to implement on-demand loading of a script based on user action. For details about this usage, see the Pause, Resume, and OnReady functions.

The Messenger Web Toolkit has its own dynamic script loader and is not integrated with the ASP.NET Ajax Library script loader.