Home

# Library goog.silverlight

Function Summary
| `__cleanup()` Releases event handler resources when the page is unloaded
| `__verifySilverlight2UpgradeSuccess(?SilverlightPlugin host) ⇒ boolean` This internal function helps identify installation state by taking advantage of behavioral differences between the 1.0 and 2.0 releases of goog.silverlight.
| `buildHtml(?Object slProperties) ⇒ string` Create HTML that instantiates the control
| `buildPromptHtml({alt: string, version: string} slPluginHelper) ⇒ string` Builds the HTML to prompt the user to download and install Silverlight
| `createObject(string source, ?Element parentElement, ?string= opt_id, ?Object= opt_properties, ?Array.<(Function|null)>= opt_events, string= opt_initParams, ?Object= opt_userContext) ⇒ ?string` Inserts a Silverlight
| `createObjectEx({context: (Object|null), events: (Array.<(Function|null)>|null), id: string, initParams: string, ...} params) ⇒ ?string` takes a single parameter of all createObject parameters enclosed in {}
| `defaultErrorHandler(?SilverlightDependencyObject sender, ?SilverlightErrorEventArgs args)` Default error handling function
| `disposeHandlerName(string handlerName)` Frees a handler created by getHandlerName.
| `followFWLink(string linkid)` Navigates to a url based on fwlinkid
| `getHandlerName((Function|null|string) handler) ⇒ ?string` Generates named event handlers for delegates. Attaches them to the global window with the name __closure_slEvent + a unique id.
| `getSilverlight(string version)` Navigates the browser to the appropriate Silverlight installer
| `htmlAttributeEncode(?string strInput) ⇒ ?string` Encodes special characters in input strings as charcodes
| `isInstalled(?string= version) ⇒ boolean` Checks to see if the correct version is installed.

`isVersionAvailableOnError(?SilverlightDependencyObject sender, ?SilverlightErrorEventArgs args) ⇒ boolean`

This function should be called at the beginning of a web page's Silverlight error handler. It will determine if the required version of Silverlight is installed and available in the current process. During its execution the function will trigger one of the Silverlight installation state events, if appropriate. Sender and Args should be passed through from the calling onError handler's parameters. The associated Sivlerlight

`isVersionAvailableOnLoad(?SilverlightDependencyObject sender) ⇒ boolean`

This function should be called at the beginning of a web page's Silverlight onLoad handler. It will determine if the required version of Silverlight is installed and available in the current process. During its execution the function will trigger one of the Silverlight installation state events, if appropriate. Sender should be passed through from the calling onError handler's parameters. The associated Sivlerlight

`onInstallRequired()`

Called by goog.silverlight.checkInstallStatus to notify the page that Silverlight has not been installed by this user. The page should respond by injecting a clear, visible, and actionable upgrade message into the DOM. The message must inform the user that they need to download and install components needed to use the page. Silverlight should be mentioned so the user expects to see that string in the installer UI. However, the Silverlight-powered application should be the focus of the solicitation. The user wants the app. Silverlight is a means to the app. The installation solicitation will have a button that directs the user to the Silverlight installer. Upon click the button should both kick off a download of the installer URL and replace the Upgrade text with "Thanks for downloading. When installation is complete you may need to refresh the page to view this content" or equivalent.

| `onRequiredVersionAvailable()` Called by version verification control to notify the page that an appropriate build of Silverlight is available. The page should respond by injecting the appropriate Silverlight control
| `onRestartRequired()` Called by version verification control to notify the page that an appropriate build of Silverlight is installed but not loaded. The page should respond by injecting a clear and visible "Thanks for installing. Please restart your browser and return to mysite.com" or equivalent into the browser DOM
| `onSilverlightInstalled()` Called by Silverlight.waitForInstallCompletion when the page detects that Silverlight has been installed. The event handler is not called in upgrade scenarios.

`onUpgradeRequired()`

Called by version verification control to notify the page that Silverlight must be upgraded. The page should respond by injecting a clear, visible, and actionable upgrade message into the DOM. The message must inform the user that they need to upgrade Silverlight to use the page. They are already somewhat familiar with the Silverlight product when they encounter this. Silverlight should be mentioned so the user expects to see that string in the installer UI. However, the Silverlight-powered application should be the focus of the solicitation. The user wants the app. Silverlight is a means to the app. The upgrade solicitation will have a button that directs the user to the Silverlight installer. Upon click the button should both kick off a download of the installer URL and replace the Upgrade text with "Thanks for downloading. When the upgarde is complete please restart your browser and return to mysite.com" or equivalent. Note: For a more interesting upgrade UX we can use Silverlight 1.0-style XAML for this upgrade experience. Contact PiotrP for details.

| `startup()` Performs startup tasks.
| `waitForInstallCompletion()` Occasionally checks for Silverlight installation status. If it detects that Silverlight has been installed then it calls Silverlight.onSilverlightInstalled();. This is only supported if Silverlight was not previously installed on this computer.