Click or drag to resize

WebBrowserExtensionsRegisterJsObject Method

Version 75.1.140
Registers a Javascript object in this specific browser instance.

Namespace:  CefSharp
Assembly:  CefSharp (in CefSharp.dll) Version: 75.1.140.0 (75.1.140.0)
Syntax
public static void RegisterJsObject(
	this IWebBrowser webBrowser,
	string name,
	Object objectToBind,
	BindingOptions options = null
)

Parameters

webBrowser
Type: CefSharpIWebBrowser
The browser to perform the registering on
name
Type: SystemString
The name of the object. (e.g. "foo", if you want the object to be accessible as window.foo).
objectToBind
Type: SystemObject
The object to be made accessible to Javascript.
options (Optional)
Type: CefSharpBindingOptions
binding options - camelCaseJavascriptNames default to true

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IWebBrowser. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Exceptions
ExceptionCondition
ExceptionBrowser is already initialized. RegisterJsObject must be + called before the underlying CEF browser is created.
See Also