From Multi Theft Auto: Wiki
Jump to navigation Jump to search

Allows resizing of CEF browsers at runtime.

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


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 true if the browser is resized successfully, false if there's something wrong.


Example for resize browser by command.

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

See Also