docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class SteamHTMLSurface

    Purpose: Functions for displaying HTML pages and interacting with them

    Inheritance
    object
    SteamHTMLSurface
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    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 ISteamHTMLSurface::AddHeader.

    string pchKey

    Passed through to ISteamHTMLSurface::AddHeader.

    string pchValue

    Passed through to ISteamHTMLSurface::AddHeader.

    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 ISteamHTMLSurface::AllowStartRequest.

    bool bAllowed

    Passed through to ISteamHTMLSurface::AllowStartRequest.

    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 ISteamHTMLSurface::CopyToClipboard.

    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 ISteamHTMLSurface::CreateBrowser.

    string pchUserCSS

    Passed through to ISteamHTMLSurface::CreateBrowser.

    Returns
    Type Description
    SteamAPICall_t

    The value ISteamHTMLSurface::CreateBrowser returns.

    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 ISteamHTMLSurface::CreateBrowser.

    string pchUserCSS

    Passed through to ISteamHTMLSurface::CreateBrowser.

    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 ISteamHTMLSurface::ExecuteJavascript.

    string pchScript

    Passed through to ISteamHTMLSurface::ExecuteJavascript.

    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 ISteamHTMLSurface::FileLoadDialogResponse.

    IntPtr pchSelectedFiles

    Passed through to ISteamHTMLSurface::FileLoadDialogResponse.

    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 ISteamHTMLSurface::Find.

    string pchSearchStr

    Passed through to ISteamHTMLSurface::Find.

    bool bCurrentlyInFind

    Passed through to ISteamHTMLSurface::Find.

    bool bReverse

    Passed through to ISteamHTMLSurface::Find.

    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 ISteamHTMLSurface::GetLinkAtPosition.

    int x

    Passed through to ISteamHTMLSurface::GetLinkAtPosition.

    int y

    Passed through to ISteamHTMLSurface::GetLinkAtPosition.

    GoBack(HHTMLBrowser)

    navigate back in the page history

    Declaration
    public static void GoBack(HHTMLBrowser unBrowserHandle)
    Parameters
    Type Name Description
    HHTMLBrowser unBrowserHandle

    Passed through to ISteamHTMLSurface::GoBack.

    GoForward(HHTMLBrowser)

    navigate forward in the page history

    Declaration
    public static void GoForward(HHTMLBrowser unBrowserHandle)
    Parameters
    Type Name Description
    HHTMLBrowser unBrowserHandle

    Passed through to ISteamHTMLSurface::GoForward.

    Init()

    Must call init and shutdown when starting/ending use of the interface

    Declaration
    public static bool Init()
    Returns
    Type Description
    bool

    The value ISteamHTMLSurface::Init returns.

    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 ISteamHTMLSurface::JSDialogResponse.

    bool bResult

    Passed through to ISteamHTMLSurface::JSDialogResponse.

    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 ISteamHTMLSurface::KeyChar.

    uint cUnicodeChar

    Passed through to ISteamHTMLSurface::KeyChar.

    EHTMLKeyModifiers eHTMLKeyModifiers

    Passed through to ISteamHTMLSurface::KeyChar.

    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 ISteamHTMLSurface::KeyDown.

    uint nNativeKeyCode

    Passed through to ISteamHTMLSurface::KeyDown.

    EHTMLKeyModifiers eHTMLKeyModifiers

    Passed through to ISteamHTMLSurface::KeyDown.

    bool bIsSystemKey

    Passed through to ISteamHTMLSurface::KeyDown.

    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 ISteamHTMLSurface::KeyUp.

    uint nNativeKeyCode

    Passed through to ISteamHTMLSurface::KeyUp.

    EHTMLKeyModifiers eHTMLKeyModifiers

    Passed through to ISteamHTMLSurface::KeyUp.

    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 ISteamHTMLSurface::LoadURL.

    string pchURL

    Passed through to ISteamHTMLSurface::LoadURL.

    string pchPostData

    Passed through to ISteamHTMLSurface::LoadURL.

    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 ISteamHTMLSurface::MouseDoubleClick.

    EHTMLMouseButton eMouseButton

    Passed through to ISteamHTMLSurface::MouseDoubleClick.

    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 ISteamHTMLSurface::MouseDown.

    EHTMLMouseButton eMouseButton

    Passed through to ISteamHTMLSurface::MouseDown.

    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 ISteamHTMLSurface::MouseMove.

    int x

    Passed through to ISteamHTMLSurface::MouseMove.

    int y

    Passed through to ISteamHTMLSurface::MouseMove.

    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 ISteamHTMLSurface::MouseUp.

    EHTMLMouseButton eMouseButton

    Passed through to ISteamHTMLSurface::MouseUp.

    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 ISteamHTMLSurface::MouseWheel.

    int nDelta

    Passed through to ISteamHTMLSurface::MouseWheel.

    OpenDeveloperTools(HHTMLBrowser)

    Open HTML/JS developer tools

    Declaration
    public static void OpenDeveloperTools(HHTMLBrowser unBrowserHandle)
    Parameters
    Type Name Description
    HHTMLBrowser unBrowserHandle

    Passed through to ISteamHTMLSurface::OpenDeveloperTools.

    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 ISteamHTMLSurface::PasteFromClipboard.

    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 ISteamHTMLSurface::Reload.

    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 ISteamHTMLSurface::RemoveBrowser.

    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 ISteamHTMLSurface::SetBackgroundMode.

    bool bBackgroundMode

    Passed through to ISteamHTMLSurface::SetBackgroundMode.

    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 ISteamHTMLSurface::SetCookie.

    string pchKey

    Passed through to ISteamHTMLSurface::SetCookie.

    string pchValue

    Passed through to ISteamHTMLSurface::SetCookie.

    string pchPath

    Passed through to ISteamHTMLSurface::SetCookie.

    uint nExpires

    Passed through to ISteamHTMLSurface::SetCookie.

    bool bSecure

    Passed through to ISteamHTMLSurface::SetCookie.

    bool bHTTPOnly

    Passed through to ISteamHTMLSurface::SetCookie.

    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 ISteamHTMLSurface::SetDPIScalingFactor.

    float flDPIScaling

    Passed through to ISteamHTMLSurface::SetDPIScalingFactor.

    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 ISteamHTMLSurface::SetHorizontalScroll.

    uint nAbsolutePixelScroll

    Passed through to ISteamHTMLSurface::SetHorizontalScroll.

    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 ISteamHTMLSurface::SetKeyFocus.

    bool bHasKeyFocus

    Passed through to ISteamHTMLSurface::SetKeyFocus.

    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 ISteamHTMLSurface::SetPageScaleFactor.

    float flZoom

    Passed through to ISteamHTMLSurface::SetPageScaleFactor.

    int nPointX

    Passed through to ISteamHTMLSurface::SetPageScaleFactor.

    int nPointY

    Passed through to ISteamHTMLSurface::SetPageScaleFactor.

    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 ISteamHTMLSurface::SetSize.

    uint unWidth

    Passed through to ISteamHTMLSurface::SetSize.

    uint unHeight

    Passed through to ISteamHTMLSurface::SetSize.

    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 ISteamHTMLSurface::SetVerticalScroll.

    uint nAbsolutePixelScroll

    Passed through to ISteamHTMLSurface::SetVerticalScroll.

    Shutdown()

    Calls the Steamworks ISteamHTMLSurface::Shutdown method.

    Declaration
    public static bool Shutdown()
    Returns
    Type Description
    bool

    The value ISteamHTMLSurface::Shutdown returns.

    StopFind(HHTMLBrowser)

    cancel a currently running find

    Declaration
    public static void StopFind(HHTMLBrowser unBrowserHandle)
    Parameters
    Type Name Description
    HHTMLBrowser unBrowserHandle

    Passed through to ISteamHTMLSurface::StopFind.

    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 ISteamHTMLSurface::StopLoad.

    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 ISteamHTMLSurface::ViewSource.

    In This Article
    Back to top
    Copyright © 2026 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)