VBTrain.Net Documentation

LmsApi2.GetJsApiLocate Function

Returns JavaScript that locates the Learning Management System (LMS) SCORM API object.

Overloads Public Function GetJsApiLocate(ByVal apiVarName As String) As String
Overloads Public Function GetJsApiLocate() As String

Parameters

apiVarName
Name of the JavaScript variable that will hold the API reference.

If not provided, the variable name "apiPointer" is used.

Remarks

The JavaScript from this function must be included prior to any other LmsApi JavaScript that references the API.

You can use the server side RegisterClientScriptBlock method to add the JavaScript from any LmsApi GetJs function to your HTML page.

Example

The following example assumes the VBTrain.WebTracking namespace has been imported. In this example, the LmsApi for the session is stored as a property (LmsApiObject) of the current class.

[Visual Basic]
Private Sub InitLmsApi()
   Dim apiObject As New LmsApi2
   Dim js As String

   apiObject.Enabled = True
   apiObject.ScormVersion = ScormVersionEnum.Version_13
   Me.LmsApiObject = apiObject

   'locate
   js = apiObject.GetJsApiLocate()
   Me.RegisterClientScriptBlock("apiLocate", js)

   'initialize
   js = apiObject.GetJsInitialize(True, True)
   If js <> "0" Then        ' not yet initialized
      Me.RegisterClientScriptBlock("apiInitialize", js)
   End If
End Sub

See Also

LmsApi2 Class | LmsApi Members | GetJsInitialize