This section describes the process of invoking ArcotID PKI Client on a Web page. Refer to the appendix, "Source Code Samples" appendix for the working sample code that is implemented by using these instructions.
<SCRIPT type="text/javascript" src="arcotclient.js"></SCRIPT>
This identifies where dynamically generated code will be inserted. Depending on the type of client invoked (Native, Java), different code may be generated in JavaScript. The code that is generated will be automatically inserted at the location of this DIV tag.
The DIV tag needs to include a unique identifier such as ArcotIDClient. This unique identifier is used in the next step.
The DIV tag is coded as follows:
<div id="ArcotIDClient"></div>
var arcotClient;
function initClient() {
arcotClient = new ArcotClient();
arcotClient.setAttribute("clientBaseURL", "client");
arcotClient.write("ArcotIDClient");
}
In the preceding example, clientBaseURL is an optional attribute. The full list of optional client invocation attributes are listed in the following table:
|
Attribute |
Possible Values |
Description |
Default Value |
|---|---|---|---|
|
clientType |
ActiveX Applet
|
Sets which client should be used. Can be invoked several times to specify an order of preference for which client should be used. For example, if it is called first with Flash and then with Applet, then when write() is invoked, the library will first try to use the Flash version and if a Flash player is not available (or not the right version of Flash), it will instead use the Applet. |
The default behavior is that the library detects the most appropriate client for the user's browser and OS combination.
|
|
clientBaseURL
|
Any URL (relative or absolute). If absolute, it must start with http:// or https:// |
Sets the URL of the directory where the different ArcotID PKI Client package files (.cab, .jar, .swf, .js) can be found.
|
The default value is "", which means the client files are expected to be found at the same directory level as the invoking Web page. |
|
clientReadyCallback |
The name of a JavaScript method on the current page.
|
This defines a JavaScript callback method that is invoked when the ArcotID PKI Client is fully initialized and ready to process API calls such as SignChallenge() and GetGlobalAttribute(). This callback can be used to ensure login buttons are disabled on a Web page until after the client loads. This is especially useful for the Java applet because the JVM can take time to initialize during the first invocation of the applet. It is strongly recommended to use this callback to avoid errors that result if ArcotID PKI Client API functions are invoked before the client is initialized and ready. |
None |
|
flashInstallURL |
URL (relative or absolute). If absolute, it must start with http:// or https:// |
URL where the user is redirected if Flash is not installed in the user's browser. |
http://www.macromedia.com/go/getflashplayer |
|
flashUpdateURL |
URL (relative or absolute). If absolute, it must start with http:// or https:// |
URL the user is redirected to if Flash is available in the user's browser but is not the required version |
http://www.adobe.com/products/flash/about/ |
|
javaInstallURL |
URL (relative or absolute). If absolute, it must start with http:// or https:// |
URL the user is redirected to if Java is not available in the user's browser |
http://www.java.com/en/download/ |
|
signedApplet |
true or false |
Whether the signed applet should be used instead of the unsigned applet. |
true |
|
ActiveXMinVersion |
A version string in the following format: |
Sets the minimum version of the ArcotID PKI ActiveX plugin that is required by the Web page. If the user has an older version of the ActiveX plugin, then the user will be prompted to upgrade to the newest version. |
5,0,0,0 |
Add a call to the initClient method (created in Step 3) to the onload event of the body tag as follows:
<body onload="initClient();">
The onload event only happens after all the resources of the pages have been loaded. Pages that have large images might take more time to load, causing the client to be instantiated only after that extra delay. An alternative to speed-up the loading process is to instead use the ready event (which is triggered as soon as the page structure is available). Because of browser incompatibilities, Arcot suggests you to use a third-party package such as jquery. Using jquery, you can replace the onload event with the following JavaScript lines:
$(document).ready(function(){
arcotClientInit();
}
|
Copyright © 2013 CA Technologies.
All rights reserved.
|
|