HU/loadBrowserURL

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Ez a függvény betölt egy adott URL-t.

Szintaxis

bool loadBrowserURL ( browser webBrowser, string url [, string postData = "", bool urlEncoded = true ] )

OOP Syntax Help! I don't understand this!

Method: browser:loadURL(...)
Variable: .url
Counterpart: getBrowserURL


Kötelező argumentumok

  • webBrowser: Az browser element amely betölti az URL-t
  • url: Az URL amit be akarsz tölteni. Ez lehet egy távoli weboldal ("http://" előtag) vagy egy weblap amit a helyi resource-ban tárolnak ("http://mta/local/gui.html" például, lásd Local Scheme Handler a részletekért).
  • postData: További adatok amiket a weboldalnak elküld. A tartalma lehet bármilyen (pl. JSON) amennyiben urlEncoded értéke false
  • urlEncoded: Ha true, elérhető lesz például a PHP $_POST változójában (a tartalom típusa: application/x-www-form-urlencoded)

Visszaadott érték

true ha az URL sikeresen be lett töltve.

Példa

-- In order to render the browser on the full screen, we need to know the dimensions.
local screenWidth, screenHeight = guiGetScreenSize()

-- Let's create a new browser in local mode. We will not be able to load an external URL.
local webBrowser = createBrowser(screenWidth, screenHeight, false, false)
	
-- This is the function to render the browser.
function webBrowserRender()
	-- Render the browser on the full size of the screen.
	dxDrawImage(0, 0, screenWidth, screenHeight, webBrowser, 0, 0, 0, tocolor(255,255,255,255), true)
end

-- The event onClientBrowserCreated will be triggered, after the browser has been initialized.
-- After this event has been triggered, we will be able to load our URL and start drawing.
addEventHandler("onClientBrowserCreated", webBrowser, 
	function()
		-- After the browser has been initialized, we can load our website.
		loadBrowserURL(webBrowser, "https://www.youtube.com/")

		-- Now we can start to render the browser.
		addEventHandler("onClientRender", root, webBrowserRender)
	end
)

Lásd még

GUI Függvények


Fordította

  • WorthlessCynomys