EditLive! 9 Documentation : setPreload Method

This property can be used when preloading EditLive!. Once EditLive! has finished loading, the JavaScript function defined by the Preload property is used as a callback.

This feature disables plugins so that dialogs are not shown on load.

 

Syntax

Visual Basic Script
object.Preload = strCallBack
ASP.NET
prefix:EditLiveJava Preload = strCallBack
JavaScript
editliveInstance.setPreload(strCallBack);

Parameters

strCallBack

A string specifying the name of a JavaScript function to use as the callback function once EditLive! has finished loading.

Examples

The following code provides the JavaScript callback function which will display an alert dialog once EditLive! has finished loading. The callback function is named preloadReturn.

<script language="javascript">
  function preloadReturn(){
    alert("EditLive! has finished preloading.");
  }
</script>

The following example instantiates a version of EditLive! and assigns a function to be used as a callback once it has finished loading. The callback used in the example code is preloadReturn which is described by the code above. The example below instantiates an applet which is not visible; thus, it may be used in cases where the applet is to be preloaded to decrease load times for future instances, but not visible.

VBScript
<%
...
editlive1.Name = "ELApplet1"
editlive1.Width = "1"
editlive1.Height = "1"
editlive1.ConfigurationFile = "sample_elconfig.xml"
editlive1.Body = "<p>&nbsp;</p>"
editlive1.Preload = "preloadReturn"
editlive1.Show()
%>
ASP.NET Server Control
<elj:EditLiveJava Name="ELApplet1"
    Width="1" 
    Height="1"
    ConfigurationFile="sample_elconfig.xml" 
    Body="<p>&nbsp;</p>" 
    Preload="preloadReturn" 
/>
JavaScript
var editlivejs;
editlivejs = new EditLiveJava("ELApplet1","1","1");
editlivejs.setConfigurationFile("sample_elconfig.xml");
editlivejs.setDocument(escape("<p>&nbsp;</p>");
editlivejs.setPreload("preloadReturn");

Remarks

The Preload property can be used to assist with the preloading of EditLive!. This can improve the performance of EditLive! within a Web application. Preloading causes the browser's XML Plug-In and the EditLive! classes to be loaded.

It is recommended that, when preloading EditLive!, you set the height and width of the EditLive! applet so they are both one pixel. This will ensure that the EditLive! applet is not visible on the page.

Preloading EditLive! can be performed on any page within a Web application.

When preloading the applet, no plugins specified for use with the editor will be loaded.