OnClientBrowserResourceBlocked
Jump to navigation
Jump to search
This event is executed when a resource (images, sounds etc.) has been blocked.
Parameters
string url, string domain, int reason
- url: the blocked URL.
- domain: the blocked domain (part of the URL).
- reason: the reason why the resource was blocked. Possibles values:
- 0: not allowed yet
- 1: blacklisted
- 2: blocked protocol scheme
Source
The browser element.
Example
This example asks the user to accept a blocked resource and reloads the browser if accepted.
local browser = guiCreateBrowser(0, 0, 800, 600, false, false, false)
local theBrowser = guiGetBrowser(browser)
showCursor(true)
addEventHandler("onClientBrowserCreated", theBrowser, function()
loadBrowserURL(source, "https://www.mta-sa.org/")
end)
local lastBrowser = nil
addEventHandler("onClientBrowserResourceBlocked", theBrowser, function(url, domain, reason)
if (reason == 0) then
lastBrowser = source
requestBrowserDomains({domain}, false, function(accepted, newDomains)
if (accepted == true) then
reloadBrowserPage(lastBrowser)
end
lastBrowser = nil
end)
end
end)
See Also
- onClientBrowserCreated
- onClientBrowserCursorChange
- onClientBrowserDocumentReady
- onClientBrowserInputFocusChanged
- onClientBrowserLoadingFailed
- onClientBrowserLoadingStart
- onClientBrowserNavigate
- onClientBrowserPopup
- onClientBrowserResourceBlocked
- onClientBrowserTooltip
- onClientBrowserWhitelistChange