OnClientBrowserCreated: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
 
Line 14: Line 14:
==Example==  
==Example==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
addEventHandler("onClientBrowserCreated", resourceRoot,
addEventHandler("onClientBrowserCreated", resourceRoot,
    function ()
function ()
                -- when the browser is loaded
    -- when the browser is loaded
loadBrowserURL(source, "http://mtasa.com") -- load MTA:SA site
    loadBrowserURL(source, "http://mtasa.com") -- load MTA:SA site
    end
end)
)
</syntaxhighlight>
</syntaxhighlight>



Latest revision as of 11:01, 4 July 2020

This event is triggered when the CEF browser instance has been created. If you want to load a specific website right after creating the browser (using createBrowser or guiCreateBrowser), this event will be the convenient place.

[[{{{image}}}|link=|]] Note: Calling loadBrowserURL right after createBrowser will not work normally due to the nature of the asynchronous browser interface.

Parameters

No parameters.

Source

The browser element.

Example

addEventHandler("onClientBrowserCreated", resourceRoot,
function ()
    -- when the browser is loaded
    loadBrowserURL(source, "http://mtasa.com") -- load MTA:SA site
end)

See Also