Click or drag to resize

IBrowser Interface

A web browser control that allows loading a web page or a local HTML file, accessing DOM and executing JavaScript on the loaded web page, getting notifications about loading progress, dispatching keyboard and mouse events, etc.

Namespace:  DotNetBrowser.Browser
Assembly:  DotNetBrowser (in DotNetBrowser.dll) Version: 2.26.2
Syntax
C#
public interface IBrowser : IDisposable, 
	IAutoDisposable

The IBrowser type exposes the following members.

Properties
  NameDescription
Public propertyAllFrames
Gets all the frames on the currently loaded web page.
Public propertyAudio
Gets the IAudio instance that allows controlling audio on the loaded web page and receive notifications when audio has been started or stopped playing.
Public propertyCapture
Gets the ICapture instance that can be used for listening and handling capture sessions.
Public propertyCast
Gets the ICast instance that can be used for casting media on receivers.
Public propertyConvertJsNameHandler
Gets or sets a handler that is used for the JavaScript name converting. Implement this handler to have control of how the names are converted when binding or executing JavaScript.
Public propertyCreatePopupHandler
Gets or sets a handler that is used when the browser decides whether a new popup instance can be created or not.
Public propertyCreditCards
Gets the ICreditCards instance that can be used for working with credit cards saved in the Chromium credit card store.
Public propertyDevTools
Gets the IDevTools instance that allows working with Chromium Developer Tools for this browser.
Public propertyDialogs
Gets the IDialogs instance that can be used for configuring the dialogs that can be shown by browser.
Public propertyDragAndDrop
Gets the IDragAndDrop instance that can be used for managing drag&drop operations for the browser.
Public propertyEngine
Gets the IEngine instance associated with this browser.
Public propertyFavicon
Gets the favicon of the currently loaded web page.
Public propertyFocusedFrame
Gets the focused frame on the currently loaded web page.
Public propertyFullScreen
Gets the IFullScreen instance that can be used for controlling the browser's fullscreen mode.
Public propertyInjectCssHandler
Gets or sets a handler that is used when the document element has been created and a custom stylesheet can be injected into the document.
Public propertyInjectJsHandler
Gets or sets a handler that is used when the document element has been created and a custom JavaScript can be injected into the document.
Public propertyIsDisposed
Indicates if the object is already disposed.
(Inherited from IAutoDisposable.)
Public propertyJsDialogs
Gets the IJsDialogs instance that can be used for configuring the JavaScript dialogs that can be shown by browser.
Public propertyKeyboard
Gets the IKeyboard instance that can be used for listening and simulating keyboard input events.
Public propertyMainFrame
The main frame on the currently loaded web page, if it exists.
Public propertyMouse
Gets the IMouse instance that can be used for listening and simulating mouse input events.
Public propertyNavigation
Gets the INavigation instance that can be used for controlling navigation in the current browser instance.
Public propertyOpenPopupHandler
Gets or sets a handler that is used when a new popup browser instance should be opened.
Public propertyPasswords
Gets the IPasswords instance that can be used for working with logins and passwords saved in the Chromium password store.
Public propertyPrintHtmlContentHandler
Gets or sets a handler that is used when the HTML content printing is initiated.
Public propertyPrintPdfContentHandler
Gets or sets a handler that is used when the PDF content printing is initiated.
Public propertyProfile
Gets the IProfile instance associated with this browser.
Public propertyRequestPdfDocumentPasswordHandler
Gets or sets a handler that is used when the frame requests the password for an encrypted PDF document.
Public propertyRequestPrintHandler
Gets or sets a handler that is used when the printing is initiated.
Public propertySelectCertificateHandler
Gets or sets a handler that is used when the web server requires authorization via client certificate.
Public propertySettings
Gets the IBrowserSettings instance that can be used for modifying the settings of the browser.
Public propertyShowContextMenuHandler
Gets or sets a handler that is used when the browser should show a context menu.
Public propertySize
Gets or sets the browser size.
Public propertyStartDownloadHandler
Gets or sets a handler that is used when the browser is about to start downloading the file.
Public propertyTextFinder
Gets the ITextFinder instance that can be used for finding text on a web page loaded in the browser.
Public propertyTitle
Gets the title of the currently loaded web page.
Public propertyTouch
Gets the ITouch instance that can be used for listening touch input events.
Public propertyUrl
Gets the URL of the currently loaded web page or an empty string if the browser hasn't loaded any web page yet.
Public propertyUserAgent
Gets or sets the user-agent of the current browser instance.
Public propertyUserDataProfiles
Gets the IUserDataProfiles instance that can be used for working with user data profiles saved in the Chromium user data store.
Public propertyZoom
Gets the IZoom instance that can be used for zooming content of a web page loaded in the current browser instance.
Top
Methods
  NameDescription
Public methodDispose
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
(Inherited from IDisposable.)
Public methodDisposeAsync
Asynchronously disposes the current browser instance according to the given options.
Public methodFocus
Tells the browser that it has focus and must be activated.
Public methodReplaceMisspelledWord
Replaces misspelled word under cursor on the currently loaded web page with the given word. If there is no misspelled word under cursor, this method does nothing.
Public methodSaveWebPage
Initiates the saving process of the currently loaded web page. The web page can be saved as a single HTML file or the file with resources. Before saving a web page make sure that it is not being loaded. It is recommended to completely loaded the web page and only then save it.
Public methodSetPrivateKeyProviderPin
Sets the key exchange PIN for the particular cryptographic service provider (CSP) and the particular key container in it. This functionality can be used to set the PIN that is requested when trying to use a client certificate stored on the smart card.
Public methodTakeImage
Creates and returns an image of the currently loaded web page.
Public methodUnfocus
Tells the browser that it does not have focus and must be deactivated.
Top
Events
  NameDescription
Public eventBrowserBecameResponsive
Occurs when the browser instance has become responsive.
Public eventBrowserBecameUnresponsive
Occurs when the browser instance has become unresponsive.
Public eventConsoleMessageReceived
Occurs when the message was added to the console.
Public eventDisposed
Occurs when the object has been disposed.
(Inherited from IAutoDisposable.)
Public eventFaviconChanged
Occurs when the web page favicon has changed.
Public eventFocusGained
Occurs when the browser instance has gained the focus.
Public eventFocusLost
Occurs when the browser instance has lost the focus.
Public eventFocusRequested
Occurs when JavaScript sends a request to focus the Browser instance by calling the window.focus() method.
Public eventFrameCreated
Occurs when the IFrame has been created.
Public eventFrameDeleted
Occurs when the IFrame has been deleted.
Public eventMediaStreamCaptureStarted
Occurs when the web page has started capturing an audio or video stream.
Public eventMediaStreamCaptureStopped
Occurs when the web page has stopped capturing an audio or video stream.
Public eventPrintPreviewClosed
Occurs when print preview dialog is closed.
Public eventPrintPreviewOpened
Occurs when print preview dialog is opened.
Public eventRenderProcessTerminated
Occurs when a render process has been terminated.
Public eventSpellCheckCompleted
Occurs when spell checking on the frame has been completed.
Public eventStatusChanged
Occurs when the status text has been changed.
Public eventTitleChanged
Occurs when the web page title has been changed.
Public eventUpdateBoundsRequested
Occurs when JavaScript requests to update bounds of the Browser instance.
Top
Remarks

The IBrowser instance itself is running in a separate native process that allocates memory and system resources that must be released. So, when a IBrowser instance is no longer needed, it must be disposed through the Dispose method to release all the allocated memory and system resources. For example:

IBrowser browser = engine.CreateBrowser();
...
browser.Dispose();

Any attempt to use an already disposed IBrowser instance will lead to the ObjectDisposedException.

The IBrowser instance is disposed automatically when its IEngine is disposed or unexpectedly crashed. If the instance represents a popup window created by JavaScript via the window.open() function, then JavaScript can close the instance using the window.close() function.

To get notifications that the IBrowser instance has been disposed please subscribe to the following event:

browser.Disposed += (s, e) => {
    // The Browser instance has been disposed.
};
See Also