| SourceLoader

Building the SourceLoader Component

The SourceLoader Crossware component makes use of JavaScript to Java calls, and essentially acts to encapsulate Java functionality for retrieving an URL from a server.

- SourceLoader.jsb

Import Page1.html and Page2.html from `(install dir)/samples/SourceLoader/`) into Visual JavaScript. One can learn how to use the SourceLoader component by inspecting the components on the page once the project is opened, and looking at how the page has been wired together.

Deploy this project (which contains sample Crossware Application pages using the SourceLoader component) to a server and load Page1.html to see a basic demonstration of the SourceLoader at work. (The files can also be copied directly to a server without using Visual JavaScript).

Page2.html illustrates using the SourceLoader in conjunction with some custom Client-side JavaScript to build a Crossware Application that loads the URL specified (it must be from the same server due to security restrictions) into a new window, with the following changes:

- The style sheet information specified is inserted at the top of the document, affecting the visual appearance of the page
  Note: The style sheet is actually inserted at the very top, even before the HTML tag -- while this is illegal, most browsers will interpret the style sheet correctly. A complete sample written specifically for style-sheet insertion should search for a more appropriate location in the document, and insert the style-sheet there.
- The text specified in the search field is replaced by the text in the replace field.

Note: For information on how to create a signed version of the SourceLoader Crossware Examples, see information on using Page Signer. This would allow the Crossware App to load URLs from any server, not just ones from the same server the SourceLoader originated from.

( return to the top of the page )