Class SteamHTMLSurface
Purpose: Functions for displaying HTML pages and interacting with them
Inherited Members
Namespace: Unity.Steamworks.Interop
Assembly: Unity.Steamworks.Interop.dll
Syntax
public static class SteamHTMLSurface
Methods
AddHeader(HHTMLBrowser, string, string)
add this header to any url requests from this browser
Declaration
public static void AddHeader(HHTMLBrowser unBrowserHandle, string pchKey, string pchValue)
Parameters
| Type | Name | Description |
|---|---|---|
| HHTMLBrowser | unBrowserHandle | Passed through to |
| string | pchKey | Passed through to |
| string | pchValue | Passed through to |
AllowStartRequest(HHTMLBrowser, bool)
CALLBACKS These set of functions are used as responses to callback requests You MUST call this in response to a HTML_StartRequest_t callback Set bAllowed to true to allow this navigation, false to cancel it and stay on the current page. You can use this feature to limit the valid pages allowed in your HTML surface.
Declaration
public static void AllowStartRequest(HHTMLBrowser unBrowserHandle, bool bAllowed)
Parameters
| Type | Name | Description |
|---|---|---|
| HHTMLBrowser | unBrowserHandle | Passed through to |
| bool | bAllowed | Passed through to |
CopyToClipboard(HHTMLBrowser)
copy the currently selected text on the html page to the local clipboard
Declaration
public static void CopyToClipboard(HHTMLBrowser unBrowserHandle)
Parameters
| Type | Name | Description |
|---|---|---|
| HHTMLBrowser | unBrowserHandle | Passed through to |
CreateBrowser(string, string)
Create a browser object for display of a html page, when creation is complete the call handle will return a HTML_BrowserReady_t callback for the HHTMLBrowser of your new browser. The user agent string is a substring to be added to the general user agent string so you can identify your client on web servers. The userCSS string lets you apply a CSS style sheet to every displayed page, leave null if you do not require this functionality. YOU MUST HAVE IMPLEMENTED HANDLERS FOR HTML_BrowserReady_t, HTML_StartRequest_t, HTML_JSAlert_t, HTML_JSConfirm_t, and HTML_FileOpenDialog_t! See the CALLBACKS section of this interface (AllowStartRequest, etc) for more details. If you do not implement these callback handlers, the browser may appear to hang instead of navigating to new pages or triggering javascript popups.
Declaration
public static SteamAPICall_t CreateBrowser(string pchUserAgent, string pchUserCSS)
Parameters
| Type | Name | Description |
|---|---|---|
| string | pchUserAgent | Passed through to |
| string | pchUserCSS | Passed through to |
Returns
| Type | Description |
|---|---|
| SteamAPICall_t | The value |
CreateBrowserAsync(string, string)
Async version of CreateBrowser(string, string).
Declaration
public static Task<HTML_BrowserReady_t> CreateBrowserAsync(string pchUserAgent, string pchUserCSS)
Parameters
| Type | Name | Description |
|---|---|---|
| string | pchUserAgent | Passed through to |
| string | pchUserCSS | Passed through to |
Returns
| Type | Description |
|---|---|
| Task<HTML_BrowserReady_t> | The HTML_BrowserReady_t Steam reports once the call completes. |
ExecuteJavascript(HHTMLBrowser, string)
run this javascript script in the currently loaded page
Declaration
public static void ExecuteJavascript(HHTMLBrowser unBrowserHandle, string pchScript)
Parameters
| Type | Name | Description |
|---|---|---|
| HHTMLBrowser | unBrowserHandle | Passed through to |
| string | pchScript | Passed through to |
FileLoadDialogResponse(HHTMLBrowser, IntPtr)
You MUST call this in response to a HTML_FileOpenDialog_t callback
Declaration
public static void FileLoadDialogResponse(HHTMLBrowser unBrowserHandle, IntPtr pchSelectedFiles)
Parameters
| Type | Name | Description |
|---|---|---|
| HHTMLBrowser | unBrowserHandle | Passed through to |
| IntPtr | pchSelectedFiles | Passed through to |
Find(HHTMLBrowser, string, bool, bool)
find this string in the browser, if bCurrentlyInFind is true then instead cycle to the next matching element
Declaration
public static void Find(HHTMLBrowser unBrowserHandle, string pchSearchStr, bool bCurrentlyInFind, bool bReverse)
Parameters
| Type | Name | Description |
|---|---|---|
| HHTMLBrowser | unBrowserHandle | Passed through to |
| string | pchSearchStr | Passed through to |
| bool | bCurrentlyInFind | Passed through to |
| bool | bReverse | Passed through to |
GetLinkAtPosition(HHTMLBrowser, int, int)
return details about the link at position x,y on the current page
Declaration
public static void GetLinkAtPosition(HHTMLBrowser unBrowserHandle, int x, int y)
Parameters
| Type | Name | Description |
|---|---|---|
| HHTMLBrowser | unBrowserHandle | Passed through to |
| int | x | Passed through to |
| int | y | Passed through to |
GoBack(HHTMLBrowser)
navigate back in the page history
Declaration
public static void GoBack(HHTMLBrowser unBrowserHandle)
Parameters
| Type | Name | Description |
|---|---|---|
| HHTMLBrowser | unBrowserHandle | Passed through to |
GoForward(HHTMLBrowser)
navigate forward in the page history
Declaration
public static void GoForward(HHTMLBrowser unBrowserHandle)
Parameters
| Type | Name | Description |
|---|---|---|
| HHTMLBrowser | unBrowserHandle | Passed through to |
Init()
Must call init and shutdown when starting/ending use of the interface
Declaration
public static bool Init()
Returns
| Type | Description |
|---|---|
| bool | The value |
JSDialogResponse(HHTMLBrowser, bool)
You MUST call this in response to a HTML_JSAlert_t or HTML_JSConfirm_t callback Set bResult to true for the OK option of a confirm, use false otherwise
Declaration
public static void JSDialogResponse(HHTMLBrowser unBrowserHandle, bool bResult)
Parameters
| Type | Name | Description |
|---|---|---|
| HHTMLBrowser | unBrowserHandle | Passed through to |
| bool | bResult | Passed through to |
KeyChar(HHTMLBrowser, uint, EHTMLKeyModifiers)
cUnicodeChar is the unicode character point for this keypress (and potentially multiple chars per press)
Declaration
public static void KeyChar(HHTMLBrowser unBrowserHandle, uint cUnicodeChar, EHTMLKeyModifiers eHTMLKeyModifiers)
Parameters
| Type | Name | Description |
|---|---|---|
| HHTMLBrowser | unBrowserHandle | Passed through to |
| uint | cUnicodeChar | Passed through to |
| EHTMLKeyModifiers | eHTMLKeyModifiers | Passed through to |
KeyDown(HHTMLBrowser, uint, EHTMLKeyModifiers, bool)
keyboard interactions, native keycode is the virtual key code value from your OS, system key flags the key to not be sent as a typed character as well as a key down
Declaration
public static void KeyDown(HHTMLBrowser unBrowserHandle, uint nNativeKeyCode, EHTMLKeyModifiers eHTMLKeyModifiers, bool bIsSystemKey = false)
Parameters
| Type | Name | Description |
|---|---|---|
| HHTMLBrowser | unBrowserHandle | Passed through to |
| uint | nNativeKeyCode | Passed through to |
| EHTMLKeyModifiers | eHTMLKeyModifiers | Passed through to |
| bool | bIsSystemKey | Passed through to |
KeyUp(HHTMLBrowser, uint, EHTMLKeyModifiers)
Calls the Steamworks ISteamHTMLSurface::KeyUp method.
Declaration
public static void KeyUp(HHTMLBrowser unBrowserHandle, uint nNativeKeyCode, EHTMLKeyModifiers eHTMLKeyModifiers)
Parameters
| Type | Name | Description |
|---|---|---|
| HHTMLBrowser | unBrowserHandle | Passed through to |
| uint | nNativeKeyCode | Passed through to |
| EHTMLKeyModifiers | eHTMLKeyModifiers | Passed through to |
LoadURL(HHTMLBrowser, string, string)
Navigate to this URL, results in a HTML_StartRequest_t as the request commences
Declaration
public static void LoadURL(HHTMLBrowser unBrowserHandle, string pchURL, string pchPostData)
Parameters
| Type | Name | Description |
|---|---|---|
| HHTMLBrowser | unBrowserHandle | Passed through to |
| string | pchURL | Passed through to |
| string | pchPostData | Passed through to |
MouseDoubleClick(HHTMLBrowser, EHTMLMouseButton)
Calls the Steamworks ISteamHTMLSurface::MouseDoubleClick method.
Declaration
public static void MouseDoubleClick(HHTMLBrowser unBrowserHandle, EHTMLMouseButton eMouseButton)
Parameters
| Type | Name | Description |
|---|---|---|
| HHTMLBrowser | unBrowserHandle | Passed through to |
| EHTMLMouseButton | eMouseButton | Passed through to |
MouseDown(HHTMLBrowser, EHTMLMouseButton)
Calls the Steamworks ISteamHTMLSurface::MouseDown method.
Declaration
public static void MouseDown(HHTMLBrowser unBrowserHandle, EHTMLMouseButton eMouseButton)
Parameters
| Type | Name | Description |
|---|---|---|
| HHTMLBrowser | unBrowserHandle | Passed through to |
| EHTMLMouseButton | eMouseButton | Passed through to |
MouseMove(HHTMLBrowser, int, int)
x and y are relative to the HTML bounds
Declaration
public static void MouseMove(HHTMLBrowser unBrowserHandle, int x, int y)
Parameters
| Type | Name | Description |
|---|---|---|
| HHTMLBrowser | unBrowserHandle | Passed through to |
| int | x | Passed through to |
| int | y | Passed through to |
MouseUp(HHTMLBrowser, EHTMLMouseButton)
Mouse click and mouse movement commands
Declaration
public static void MouseUp(HHTMLBrowser unBrowserHandle, EHTMLMouseButton eMouseButton)
Parameters
| Type | Name | Description |
|---|---|---|
| HHTMLBrowser | unBrowserHandle | Passed through to |
| EHTMLMouseButton | eMouseButton | Passed through to |
MouseWheel(HHTMLBrowser, int)
nDelta is pixels of scroll
Declaration
public static void MouseWheel(HHTMLBrowser unBrowserHandle, int nDelta)
Parameters
| Type | Name | Description |
|---|---|---|
| HHTMLBrowser | unBrowserHandle | Passed through to |
| int | nDelta | Passed through to |
OpenDeveloperTools(HHTMLBrowser)
Open HTML/JS developer tools
Declaration
public static void OpenDeveloperTools(HHTMLBrowser unBrowserHandle)
Parameters
| Type | Name | Description |
|---|---|---|
| HHTMLBrowser | unBrowserHandle | Passed through to |
PasteFromClipboard(HHTMLBrowser)
paste from the local clipboard to the current html page
Declaration
public static void PasteFromClipboard(HHTMLBrowser unBrowserHandle)
Parameters
| Type | Name | Description |
|---|---|---|
| HHTMLBrowser | unBrowserHandle | Passed through to |
Reload(HHTMLBrowser)
Reload (most likely from local cache) the current page
Declaration
public static void Reload(HHTMLBrowser unBrowserHandle)
Parameters
| Type | Name | Description |
|---|---|---|
| HHTMLBrowser | unBrowserHandle | Passed through to |
RemoveBrowser(HHTMLBrowser)
Call this when you are done with a html surface, this lets us free the resources being used by it
Declaration
public static void RemoveBrowser(HHTMLBrowser unBrowserHandle)
Parameters
| Type | Name | Description |
|---|---|---|
| HHTMLBrowser | unBrowserHandle | Passed through to |
SetBackgroundMode(HHTMLBrowser, bool)
Enable/disable low-resource background mode, where javascript and repaint timers are throttled, resources are more aggressively purged from memory, and audio/video elements are paused. When background mode is enabled, all HTML5 video and audio objects will execute ".pause()" and gain the property "._steam_background_paused = 1". When background mode is disabled, any video or audio objects with that property will resume with ".play()".
Declaration
public static void SetBackgroundMode(HHTMLBrowser unBrowserHandle, bool bBackgroundMode)
Parameters
| Type | Name | Description |
|---|---|---|
| HHTMLBrowser | unBrowserHandle | Passed through to |
| bool | bBackgroundMode | Passed through to |
SetCookie(string, string, string, string, uint, bool, bool)
set a webcookie for the hostname in question
Declaration
public static void SetCookie(string pchHostname, string pchKey, string pchValue, string pchPath = "/", uint nExpires = 0, bool bSecure = false, bool bHTTPOnly = false)
Parameters
| Type | Name | Description |
|---|---|---|
| string | pchHostname | Passed through to |
| string | pchKey | Passed through to |
| string | pchValue | Passed through to |
| string | pchPath | Passed through to |
| uint | nExpires | Passed through to |
| bool | bSecure | Passed through to |
| bool | bHTTPOnly | Passed through to |
SetDPIScalingFactor(HHTMLBrowser, float)
Scale the output display space by this factor, this is useful when displaying content on high dpi devices. Specifies the ratio between physical and logical pixels.
Declaration
public static void SetDPIScalingFactor(HHTMLBrowser unBrowserHandle, float flDPIScaling)
Parameters
| Type | Name | Description |
|---|---|---|
| HHTMLBrowser | unBrowserHandle | Passed through to |
| float | flDPIScaling | Passed through to |
SetHorizontalScroll(HHTMLBrowser, uint)
programmatically scroll this many pixels on the page
Declaration
public static void SetHorizontalScroll(HHTMLBrowser unBrowserHandle, uint nAbsolutePixelScroll)
Parameters
| Type | Name | Description |
|---|---|---|
| HHTMLBrowser | unBrowserHandle | Passed through to |
| uint | nAbsolutePixelScroll | Passed through to |
SetKeyFocus(HHTMLBrowser, bool)
tell the html control if it has key focus currently, controls showing the I-beam cursor in text controls amongst other things
Declaration
public static void SetKeyFocus(HHTMLBrowser unBrowserHandle, bool bHasKeyFocus)
Parameters
| Type | Name | Description |
|---|---|---|
| HHTMLBrowser | unBrowserHandle | Passed through to |
| bool | bHasKeyFocus | Passed through to |
SetPageScaleFactor(HHTMLBrowser, float, int, int)
Zoom the current page by flZoom ( from 0.0 to 2.0, so to zoom to 120% use 1.2 ), zooming around point X,Y in the page (use 0,0 if you don't care)
Declaration
public static void SetPageScaleFactor(HHTMLBrowser unBrowserHandle, float flZoom, int nPointX, int nPointY)
Parameters
| Type | Name | Description |
|---|---|---|
| HHTMLBrowser | unBrowserHandle | Passed through to |
| float | flZoom | Passed through to |
| int | nPointX | Passed through to |
| int | nPointY | Passed through to |
SetSize(HHTMLBrowser, uint, uint)
Tells the surface the size in pixels to display the surface
Declaration
public static void SetSize(HHTMLBrowser unBrowserHandle, uint unWidth, uint unHeight)
Parameters
| Type | Name | Description |
|---|---|---|
| HHTMLBrowser | unBrowserHandle | Passed through to |
| uint | unWidth | Passed through to |
| uint | unHeight | Passed through to |
SetVerticalScroll(HHTMLBrowser, uint)
Calls the Steamworks ISteamHTMLSurface::SetVerticalScroll method.
Declaration
public static void SetVerticalScroll(HHTMLBrowser unBrowserHandle, uint nAbsolutePixelScroll)
Parameters
| Type | Name | Description |
|---|---|---|
| HHTMLBrowser | unBrowserHandle | Passed through to |
| uint | nAbsolutePixelScroll | Passed through to |
Shutdown()
Calls the Steamworks ISteamHTMLSurface::Shutdown method.
Declaration
public static bool Shutdown()
Returns
| Type | Description |
|---|---|
| bool | The value |
StopFind(HHTMLBrowser)
cancel a currently running find
Declaration
public static void StopFind(HHTMLBrowser unBrowserHandle)
Parameters
| Type | Name | Description |
|---|---|---|
| HHTMLBrowser | unBrowserHandle | Passed through to |
StopLoad(HHTMLBrowser)
Stop the load of the current html page
Declaration
public static void StopLoad(HHTMLBrowser unBrowserHandle)
Parameters
| Type | Name | Description |
|---|---|---|
| HHTMLBrowser | unBrowserHandle | Passed through to |
ViewSource(HHTMLBrowser)
open the current pages html code in the local editor of choice, used for debugging
Declaration
public static void ViewSource(HHTMLBrowser unBrowserHandle)
Parameters
| Type | Name | Description |
|---|---|---|
| HHTMLBrowser | unBrowserHandle | Passed through to |