GetBrowserSettings: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
Line 19: Line 19:
==Example==
==Example==
<section name="Example" class="client" show="true">
<section name="Example" class="client" show="true">
this creates a browser and get the browser settings onClientBrowserCreated
This creates a browser and get the browser settings when creating the browser
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
window = guiCreateWindow(377, 156, 671, 454, "", false)
window = guiCreateWindow(377, 156, 671, 454, "", false)

Revision as of 18:09, 8 June 2020

This function returns a table containing the browser settings.

Syntax

table getBrowserSettings ()

OOP Syntax Help! I don't understand this!

Method: Browser.getSettings(...)


Returns

A table having the following keys:

  • RemoteEnabled: true if remote websites are enabled, false otherwise
  • RemoteJavascript: true if Javascript is enabled on remote websites, false otherwise
  • PluginsEnabled: true if plugins such as Flash, Silverlight (but not Java) are enabled, false otherwise. This setting is false by default.

Example

Click to collapse [-]
Example

This creates a browser and get the browser settings when creating the browser

window = guiCreateWindow(377, 156, 671, 454, "", false)
guiWindowSetSizable(window, true)

webBrowser = guiCreateBrowser(9, 26, 652, 418, false, false, false, window)

local theBrowser = guiGetBrowser(webBrowser)

addEventHandler("onClientBrowserCreated", theBrowser, function()
showCursor(true)
loadBrowserURL(source, "http://google.com\\")
for k,v in pairs(getBrowserSettings(theBrowser)) do
outputChatBox("['"..tostring(k).."'] = "..tostring(v))
end
end
)

See Also