Functions | HTML Surface

Here is a list of all the functions available in the GodotSteam module. The descriptions are pulled from the official Steamworks SDK documentation with modifications made to fit GodotSteam's implementation of the functions. Naturally, any GodotSteam-specific functions will be noted as such.


addHeader( string key, string value )

  • Add a header to any HTTP requests from this browser. A full list of standard request fields are available here on Wikipedia.
  • Returns nothing; void.

allowStartRequest( bool allowed )

  • Sets whether a pending load is allowed or if it should be canceled. You can use this feature to limit the valid pages allowed in your HTML surface.
  • Note: You must call this in response to a html_start_request callback.
  • Returns nothing; void.

copyToClipboard()

  • Copy the currently selected text from the current page in an HTML surface into the local clipboard.
  • Returns nothing; void.

createBrowser( string user_agent, string user_css )

  • Create a browser object for displaying of an HTML page.
  • Note: You must call removeBrowser when you are done using this browser to free up the resources associated with it. Failing to do so will result in a memory leak.
  • Returns nothing; void.

executeJavascript( string script )

  • Run a javascript script in the currently loaded page.
  • Returns nothing; void.

find( string search, bool currently_in_find, bool reverse )

  • Find a string in the current page of an HTML surface. This is the equivalent of "ctrl+f" in your browser of choice. It will highlight all of the matching strings. You should call stopFind when the input string has changed or you want to stop searching.
  • Triggers a html_search_results callback.
  • Returns nothing; void.

getLinkAtPosition( int x, int y )

  • Retrieves details about a link at a specific position on the current page in an HTML surface.
  • Triggers a html_link_at_position callback.
  • Returns nothing; void.

goBack()

  • Navigate back in the page history.
  • Returns nothing; void.

goForward()

  • Navigate forward in the page history.
  • Returns nothing; void.

htmlInit()

  • Initializes the HTML Surface API. This must be called prior to using any other functions in this interface. You must call htmlShutdown when you are done using the interface to free up the resources associated with it. Failing to do so will result in a memory leak.
  • Returns nothing; void.

jsDialogResponse( bool result )

  • Allows you to react to a page wanting to open a javascript modal dialog notification.
  • Note: You must call this in response to html_js_alert and html_js_confirm callbacks.
  • Returns nothing; void.

keyChar( int unicode_char, int key_modifiers ) keyChar( uint32 unicode_char, int key_modifiers )

  • unicode_char is the unicode character point for this keypress (and potentially multiple chars per press).
  • Returns nothing; void.

keyDown( int native_key_code, int key_modifiers ) keyDown( uint32 native_key_code, int key_modifiers )

  • Keyboard interactions, native keycode is the virtual key code value from your OS.
  • Returns nothing; void.

keyUp( int native_key_code, int key_modifiers ) keyUp( uint32 native_key_code, int key_modifiers )

  • Keyboard interactions, native keycode is the virtual key code value from your OS.
  • Returns nothing; void.

loadURL( string url, string post_data )

  • Navigate to a specified URL. If you send POST data with post_data then the data should be formatted as: name1=value1&name2=value2. You can load any URI scheme supported by Chromium Embedded Framework including but not limited to: http://, https://, ftp://, and file:///. If no scheme is specified then http:// is used.
  • Triggers a html_start_request callback.
  • Returns nothing; void.

mouseDoubleClick( int mouseButton )

  • Tells an HTML surface that a mouse button has been double clicked. The click will occur where the surface thinks the mouse is based on the last call to mouseMove.
  • Returns nothing; void.

mouseDown( int mouse_button )

  • Tells an HTML surface that a mouse button has been pressed. The click will occur where the surface thinks the mouse is based on the last call to mouseMove.
  • Returns nothing; void.

mouseMove( int x, int y )

  • Tells an HTML surface where the mouse is.
  • Returns nothing; void.

mouseUp( int mouse_button )

  • Tells an HTML surface that a mouse button has been released. The click will occur where the surface thinks the mouse is based on the last call to mouseMove.
  • Returns nothing; void.

mouseWheel( int delta ) mouseWheel( int32 delta )

  • Tells an HTML surface that the mouse wheel has moved.
  • Returns nothing; void.

pasteFromClipboard()

  • Paste from the local clipboard to the current page in an HTML surface.
  • Returns nothing; void.

reload()

  • Refreshes the current page. The reload will most likely hit the local cache instead of going over the network. This is equivalent to F5 or Ctrl+R in your browser of choice.
  • Returns nothing; void.

removeBrowser()

  • You must call this when you are done with an HTML surface, freeing the resources associated with it. Failing to call this will result in a memory leak.
  • Returns nothing; void.

setBackgroundMode( bool background_mode )

  • 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()".
  • Returns nothing; void.

setCookie( string hostname, string key, string value, string path, int expires, bool secure, bool http_only ) setCookie( string hostname, string key, string value, string path, uint32 expires, bool secure, bool http_only )

  • Set a webcookie for a specific hostname. You can read more about the specifics of setting cookies here on Wikipedia.
  • Returns nothing; void.

setHorizontalScroll( int absolute_pixel_scroll ) setHorizontalScroll( uint32 absolute_pixel_scroll )

  • Scroll the current page horizontally.
  • Triggers a html_horizontal_scroll callback.
  • Returns nothing; void.

setKeyFocus( bool has_key_focus )

  • Tell a HTML surface if it has key focus currently, controls showing the I-beam cursor in text controls amongst other things.
  • Returns nothing; void.

setPageScaleFactor( float zoom, int pointX, int pointY )

  • Zoom the current page in an HTML surface. The current scale factor is available from HTML_NeedsPaint_t.flPageScale, HTML_HorizontalScroll_t.flPageScale, and HTML_VerticalScroll_t.flPageScale.
  • Returns nothing; void.

setSize( int width, int height ) setSize( uint32 width, uint32 height )

  • Sets the display size of a surface in pixels.
  • Returns nothing; void.

setVerticalScroll( int absolute_pixel_scroll ) setVerticalScroll( uint32 absolute_pixel_scroll )

  • Scroll the current page vertically.
  • Triggers a html_vertical_scroll callback.
  • Returns nothing; void.

htmlShutdown()

  • Shutdown the ISteamHTMLSurface interface, releasing the memory and handles. You must call this when you are done using this interface to prevent memory and handle leaks. After calling this then all of the functions provided in this interface will fail until you call Init to reinitialize again.
  • Returns a bool.

stopFind()

  • Cancel a currently running find.
  • Returns nothing; void.

stopLoad()

  • Stop the load of the current HTML page.
  • Returns nothing; void.

viewSource()

  • Open the current pages HTML source code in default local text editor, used for debugging.
  • Returns nothing; void.