The vSphere Client loads plug-in resources in a tenant iFrame. The plug-in must load a thin JavaScript library to support communication with the parent window in the vSphere Client. The library implements a JavaScript API that the plug-in front-end code uses to manage resources outside its iFrame.
To bootstrap the Client Library the following script should be added to all HTML pages in the plug-in:
<script type="text/javascript"src="/api/ui/htmlClientSdk.js"></script>After you load the script, you initialize the
htmlClientSdk
object, by invoking the
htmlClientSdk.initialize()
method. Before you initialize, you can only invoke the methods of the
htmlClientSdk
interface. After you initialize the
htmlClientSdk
object, you can invoke any of the methods in the JavaScript API.
If you use frameworks such as jQuery, or zone.js with Angular, you only need to initialize the htmlClientSdk
object once. You should initialize as early as possible, so that the htmlClientSdk
functions will be available to all plug-in user interface components.
Note: Do not use any communication method not provided by the APIs. Do not access any internal JavaScript or CSS resources of the vSphere Client. Doing so is unsupported because the implementation of the
htmlClientSdk
functions can change in future releases of the vSphere Client.