resizeBrowser | Multi Theft Auto: Wiki Skip to content

resizeBrowser

Client-side
Server-side
Shared

Allows resizing of CEF browsers at runtime.

Caution

Do not use this function with onClientRender as it re-creates the underlying texture internally (which is an expensive operation).

OOP Syntax Help! I don't understand this!

Syntax

bool resizeBrowser ( browser webBrowser, float width, float height )
Required Arguments
  • webBrowser: The browser you want to resize.
  • width: The new width of the browser.
  • height: The new height of the browser.

Returns

  • bool: result

Returns true if the browser is resized successfully, false if there's something wrong.

Code Examples

client

Example for resize browser by command.

local screenWidth, screenHeight = guiGetScreenSize()
local initBrowser = guiCreateBrowser(0, 0, screenWidth, screenHeight, true, true, false)
addCommandHandler("resize",
function ( cmd, width, height )
local browser = guiGetBrowser(initBrowser)
local width, height = tonumber(width), tonumber(height)
resizeBrowser( browser, width, height )
end
)