OnClientBrowserLoadingStart: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "__NOTOC__ {{Client event}} {{New feature/item|3.0150|1.5|| The event is triggered when a webbrowser starts loading a page. }} ==Parameters== <syntaxhighlight lan...")
 
No edit summary
Line 10: Line 10:
</syntaxhighlight>
</syntaxhighlight>
*'''URL:''' [[string]] containing the URL that will be loaded.
*'''URL:''' [[string]] containing the URL that will be loaded.
*'''isMain:''' [[boolean]] true if the URL is loaded in the main frame. false if the URL is loaded in a sub-frame, e.g. in an iFrame.
*'''isMain:''' [[boolean]]
** '''true''': If the URL is loaded in the main frame.
** '''false''': If the URL is loaded in a sub-frame, e.g. in an iFrame.


==Source==
==Source==

Revision as of 20:16, 19 September 2018

The event is triggered when a webbrowser starts loading a page.

Parameters

string URL, boolean isMain
  • URL: string containing the URL that will be loaded.
  • isMain: boolean
    • true: If the URL is loaded in the main frame.
    • false: If the URL is loaded in a sub-frame, e.g. in an iFrame.

Source

The webbrowser element.

Example

local browser = guiCreateBrowser(0, 0, 800, 600, false, false, false)
local theBrowser = guiGetBrowser(browser)
showCursor(true)


addEventHandler("onClientBrowserLoadingStart", theBrowser, function(url, isMain)
  if (isMain) then
    outputChatBox("Loading "..url.." in the main frame...")
  else
    outputChatBox("Loading "..url.." in a sub main frame...")
  end
end)

addEventHandler("onClientBrowserCreated", theBrowser, function()
  loadBrowserURL(source, "https://www.w3schools.com/html/html_iframe.asp")
end)


See Also