DotNetBrowser  1.14
Public Types | Static Public Member Functions | Public Attributes | Properties | List of all members
DotNetBrowser.BrowserPreferences Class Reference

Browser instance and global library preferences. More...

Public Types

enum  WebRTCIPHandlingPolicyEnum {
  WebRTCIPHandlingPolicyEnum.Unsupported = -1, WebRTCIPHandlingPolicyEnum.Empty = 0, WebRTCIPHandlingPolicyEnum.Default = 1, WebRTCIPHandlingPolicyEnum.DefaultPublicInterfaceOnly = 2,
  WebRTCIPHandlingPolicyEnum.DefaultPublicAndPrivateInterfaces = 3, WebRTCIPHandlingPolicyEnum.DisableNonProxiedUdp = 4
}
 The list of supported WebRTC IP handling policy More...
 

Static Public Member Functions

static void SetChromiumDir (string chromiumDir)
 Configures the library with absolute path to the directory where Chromium binaries are located. More...
 
static string GetChromiumDir ()
 Returns path to the directory where Chromium binaries are located or empty string if there's no such path. If the directory wasn't configured via SetChromiumDir(string) method, then this method returns default value via the GetDefaultChromiumDir() method. More...
 
static void SetUserAgent (string userAgent)
 Configures the user agent string for all Browser instances. This method must be invoked before you create any Browser instance. If you don't provide user agent string using this method, then a default user agent string will be used. More...
 
static string GetUserAgent ()
 Returns the user agent string which was set using the SetUserAgent(string) method. Can return null if the user agent string wasn't provided via the SetUserAgent(string) method. This method cannot be used to receive a default user agent string. More...
 
static string GetDefaultChromiumDir ()
 Returns the path to the directory where Chromium binaries will be extracted by default. The absolute path to the default directory with Chromium binaries is: More...
 
static string GetDefaultDataDir ()
 Returns the path to the directory where user data files (e.g. history, cookies) will be stored. To calculate the path to this directory the method uses the following way: getDefaultChromiumDir() + "/data" More...
 
static string GetDefaultAcceptLanguage ()
 Returns the default accept language, represented by the string constructed from user.language and user.country system properties (e.g. en-us). More...
 
static void SetChromiumSwitches (params string[] switches)
 Configures Chromium engine to use the command line flags (switches) in order to enable particular features or modify default functionality. More...
 
static List< string > GetChromiumSwitches ()
 Returns the Chromium switches that were set via the SetChromiumSwitches(string[]) method. More...
 
static void SetChromiumVariable (string name, string value)
 Sets Chromium environment variables that will be passed to each Chromium process. Use this method when you need to provide environment variables to Chromium. For example, you can provide your GOOGLE_API_KEY, GOOGLE_DEFAULT_CLIENT_ID and GOOGLE_DEFAULT_CLIENT_SECRET environment variables to Chromium to enable Google APIs (see API Keys).

Parameters
namea string representation of the variable name. Cannot be
More...
 
static Dictionary< string, string > GetChromiumVariables ()
 Returns copy of Chromium environment variables set via SetChromiumVariable(String, String) or empty map if no environment variables were set. More...
 

Public Attributes

const string CHROMIUM_DIR_VARIABLE = "DOTNETBROWSER_BIN_DIR"
 The name of system environment variable that contains absolute path to Chromium binaries directory. More...
 

Properties

string DefaultEncoding [get, set]
 Default encoding for web pages. More...
 
bool JavaScriptEnabled [get, set]
 JavaScript can be executed on the web page. More...
 
bool JavaScriptCanAccessClipboard [get, set]
 JavaScript can access clipboard. More...
 
bool LoadsImagesAutomatically [get, set]
 Images are loaded automatically. More...
 
bool ImagesEnabled [get, set]
 Images are displayed. More...
 
bool PluginsEnabled [get, set]
 Plugins are enabled. More...
 
bool AllowScriptsToCloseWindows [get, set]
 JavaScript can close window. More...
 
bool LocalStorageEnabled [get, set]
 Local storage is enabled. More...
 
bool DatabasesEnabled [get, set]
 DataBases are enbaled. More...
 
bool WebAudioEnabled [get, set]
 Web Audio is enabled. More...
 
bool ApplicationCacheEnabled [get, set]
 Application cache is enabled. More...
 
bool AllowDisplayingInsecureContent [get, set]
 Allow displaying insecure content. More...
 
bool AllowRunningInsecureContent [get, set]
 Allow running insecure content. More...
 
bool UnifiedTextcheckerEnabled [get, set]
 Text checker is enabled More...
 
bool FireMouseEventsEnabled [get, set]
 Fire mouse events is enabled More...
 
bool FireKeyboardEventsEnabled [get, set]
 Fire keyboard events is enabled More...
 
bool FireGestureEventsEnabled [get, set]
 Fire gesture events is enabled More...
 
WebRTCIPHandlingPolicyEnum WebRTCIPHandlingPolicy [get, set]
 This will protect against WebRTC leaks - while leaving WebRTC enabled. More...
 
bool TransparentBackground [get, set]
 Enables or disables HTML Transparent Background support. More...
 
static bool SandboxEnabled [get, set]
 Gets or sets sandbox status for render process. By default sandbox disabled. More...
 
static string ChromiumProcessName [get, set]
 Gets or sets chromium process file name. By default is "DotNetBrowser.Chromium.exe". More...
 
static string ChromiumDirName [get, set]
 Gets or sets the name of the directory in which the chromium binaries will be extracted to the temporary folder for the user. By default is "dotnetbrowser-chromium". More...
 
static string CrashDumpDir [get, set]
 The path to the directory where Chromium crash dumps will be stored. More...
 

Detailed Description

Browser instance and global library preferences.

Member Enumeration Documentation

The list of supported WebRTC IP handling policy

Enumerator
Unsupported 
Empty 
Default 
DefaultPublicInterfaceOnly 

Use the default public interface only. Send WebRTC traffic via the default public network adapter. This will be the VPN adapter for system-VPN users.

DefaultPublicAndPrivateInterfaces 

Use the default public interface and private interface. Same as DefaultPublicInterfaceOnly, except allow WebRTC traffic through the default private interface to your local network as well.

DisableNonProxiedUdp 

Disable non-proxied UDP (force proxy). Force the use of a proxy, and only allow WebRTC traffic over UDP proxies. This will effectively disable WebRTC communication for most users (depending on UDP proxy usage).

Member Function Documentation

static string DotNetBrowser.BrowserPreferences.GetChromiumDir ( )
static

Returns path to the directory where Chromium binaries are located or empty string if there's no such path. If the directory wasn't configured via SetChromiumDir(string) method, then this method returns default value via the GetDefaultChromiumDir() method.

Returns
path to the directory where Chromium binaries are located or empty string if there's no such path.
static List<string> DotNetBrowser.BrowserPreferences.GetChromiumSwitches ( )
static

Returns the Chromium switches that were set via the SetChromiumSwitches(string[]) method.

Returns
a list of Chromium switches.
static Dictionary<string, string> DotNetBrowser.BrowserPreferences.GetChromiumVariables ( )
static

Returns copy of Chromium environment variables set via SetChromiumVariable(String, String) or empty map if no environment variables were set.

static string DotNetBrowser.BrowserPreferences.GetDefaultAcceptLanguage ( )
static

Returns the default accept language, represented by the string constructed from user.language and user.country system properties (e.g. en-us).

Returns
the default accept language, represented by the string constructed from user.language and user.country system properties (e.g. en-us). If empty or null - returns "en-us".
static string DotNetBrowser.BrowserPreferences.GetDefaultChromiumDir ( )
static

Returns the path to the directory where Chromium binaries will be extracted by default. The absolute path to the default directory with Chromium binaries is:

USER_TEMP_DIR + ChromiumDirName + ChromiumBuild

.

Returns
the path to the directory where Chromium binaries will be extracted by default.
static string DotNetBrowser.BrowserPreferences.GetDefaultDataDir ( )
static

Returns the path to the directory where user data files (e.g. history, cookies) will be stored. To calculate the path to this directory the method uses the following way: getDefaultChromiumDir() + "/data"

Returns
path to the directory where user data files will be stored.
static string DotNetBrowser.BrowserPreferences.GetUserAgent ( )
static

Returns the user agent string which was set using the SetUserAgent(string) method. Can return null if the user agent string wasn't provided via the SetUserAgent(string) method. This method cannot be used to receive a default user agent string.

Returns
the user agent string which was set using the SetUserAgent(string) method.
static void DotNetBrowser.BrowserPreferences.SetChromiumDir ( string  chromiumDir)
static

Configures the library with absolute path to the directory where Chromium binaries are located.

Parameters
chromiumDirAbsolute path to the directory with Chromium binaries.
static void DotNetBrowser.BrowserPreferences.SetChromiumSwitches ( params string[]  switches)
static

Configures Chromium engine to use the command line flags (switches) in order to enable particular features or modify default functionality.

It is important to note that using these switches is not supported or recommended. They should only be used for temporary cases and may break in the future.

Current switches may be found at http://peter.sh/examples/?/chromium-switches.html

Parameters
switchesswitches a list of command line flags (switches).
Exceptions
ArgumentExceptionwhen switches is null.
static void DotNetBrowser.BrowserPreferences.SetChromiumVariable ( string  name,
string  value 
)
static

Sets Chromium environment variables that will be passed to each Chromium process. Use this method when you need to provide environment variables to Chromium. For example, you can provide your GOOGLE_API_KEY, GOOGLE_DEFAULT_CLIENT_ID and GOOGLE_DEFAULT_CLIENT_SECRET environment variables to Chromium to enable Google APIs (see API Keys).

Parameters
namea string representation of the variable name. Cannot be

null

.

Parameters
valuevalue a string representation of the variable value. Cannot be
null
.
Exceptions
ArgumentExceptionwhen
name
or
value
is
null
.
static void DotNetBrowser.BrowserPreferences.SetUserAgent ( string  userAgent)
static

Configures the user agent string for all Browser instances. This method must be invoked before you create any Browser instance. If you don't provide user agent string using this method, then a default user agent string will be used.

Parameters
userAgenta new user agent string.
Exceptions
ArgumentExceptionwhen userAgent is null.

Member Data Documentation

const string DotNetBrowser.BrowserPreferences.CHROMIUM_DIR_VARIABLE = "DOTNETBROWSER_BIN_DIR"

The name of system environment variable that contains absolute path to Chromium binaries directory.

Property Documentation

bool DotNetBrowser.BrowserPreferences.AllowDisplayingInsecureContent
getset

Allow displaying insecure content.

bool DotNetBrowser.BrowserPreferences.AllowRunningInsecureContent
getset

Allow running insecure content.

bool DotNetBrowser.BrowserPreferences.AllowScriptsToCloseWindows
getset

JavaScript can close window.

bool DotNetBrowser.BrowserPreferences.ApplicationCacheEnabled
getset

Application cache is enabled.

string DotNetBrowser.BrowserPreferences.ChromiumDirName
staticgetset

Gets or sets the name of the directory in which the chromium binaries will be extracted to the temporary folder for the user. By default is "dotnetbrowser-chromium".

Exceptions
ArgumentExceptionwhen set value null or empty
string DotNetBrowser.BrowserPreferences.ChromiumProcessName
staticgetset

Gets or sets chromium process file name. By default is "DotNetBrowser.Chromium.exe".

Exceptions
ArgumentExceptionwhen set value null or empty
string DotNetBrowser.BrowserPreferences.CrashDumpDir
staticgetset

The path to the directory where Chromium crash dumps will be stored.

bool DotNetBrowser.BrowserPreferences.DatabasesEnabled
getset

DataBases are enbaled.

string DotNetBrowser.BrowserPreferences.DefaultEncoding
getset

Default encoding for web pages.

bool DotNetBrowser.BrowserPreferences.FireGestureEventsEnabled
getset

Fire gesture events is enabled

bool DotNetBrowser.BrowserPreferences.FireKeyboardEventsEnabled
getset

Fire keyboard events is enabled

bool DotNetBrowser.BrowserPreferences.FireMouseEventsEnabled
getset

Fire mouse events is enabled

bool DotNetBrowser.BrowserPreferences.ImagesEnabled
getset

Images are displayed.

bool DotNetBrowser.BrowserPreferences.JavaScriptCanAccessClipboard
getset

JavaScript can access clipboard.

bool DotNetBrowser.BrowserPreferences.JavaScriptEnabled
getset

JavaScript can be executed on the web page.

bool DotNetBrowser.BrowserPreferences.LoadsImagesAutomatically
getset

Images are loaded automatically.

bool DotNetBrowser.BrowserPreferences.LocalStorageEnabled
getset

Local storage is enabled.

bool DotNetBrowser.BrowserPreferences.PluginsEnabled
getset

Plugins are enabled.

bool DotNetBrowser.BrowserPreferences.SandboxEnabled
staticgetset

Gets or sets sandbox status for render process. By default sandbox disabled.

bool DotNetBrowser.BrowserPreferences.TransparentBackground
getset

Enables or disables HTML Transparent Background support.

bool DotNetBrowser.BrowserPreferences.UnifiedTextcheckerEnabled
getset

Text checker is enabled

bool DotNetBrowser.BrowserPreferences.WebAudioEnabled
getset

Web Audio is enabled.

WebRTCIPHandlingPolicyEnum DotNetBrowser.BrowserPreferences.WebRTCIPHandlingPolicy
getset

This will protect against WebRTC leaks - while leaving WebRTC enabled.