HTML Bridge: Interaction Between HTML and Managed Code


In Silverlight, the HTML Bridge is an integrated set of types and methods that enable you to do the following:

  • Expose complete managed types to JavaScript for scripting.

  • Expose individual methods of managed types to JavaScript for scripting.

  • Pass managed types as parameters to JavaScript functions and objects.

  • Return managed types from JavaScript.

  • Assign managed types as event handlers, which are callable from JavaScript.

  • Call JavaScript event handlers from managed types.

  • Control various security aspects of your Silverlight-based application.

In addition, the HTML Bridge provides managed containers for Document Object Model (DOM) elements such as window, document, and standard HTML elements.

Note Note:

Silverlight for Windows Phone Silverlight for Windows Phone does not support the HTML Bridge feature.

Making Silverlight Scriptable by JavaScript

Explains how to enable JavaScript to access Silverlight application code.

Exception Handling Behavior in HTML Bridge

Explains how exceptions are passed between managed code and JavaScript code in Silverlight.

Security Settings in HTML Bridge

Describes the two security settings that control how Silverlight interacts with JavaScript and DOM code.

Silverlight and JavaScript Marshaling

Discusses how managed types are returned or passed to JavaScript, how JavaScript objects are passed to managed code, and how managed types are constructed from JavaScript.

Walkthrough: Calling JavaScript from Managed Code

Shows how to call JavaScript from managed code in a Silverlight-based application.

Walkthrough: Calling Managed Code from JavaScript

Shows how to call managed code from JavaScript in a Silverlight-based application.