getBrowserURL
Client-side
Server-side
Shared
Pair: loadBrowserURL
This function returns the URL of the specified browser.
OOP Syntax Help! I don't understand this!
- Method:browser:getURL(...)
- Variable: .url
Syntax
string|false getBrowserURL ( browser webBrowser )Required Arguments
- webBrowser: The browser.
Returns
- string|false: url
Returns the web browser URL. Returns false if the browser element is invalid.
Code Examples
client
This example creates a command /isyoutubeloaded to check if the browser created have youtube loaded, if it isnt it loads youtube.
-- In order to render the browser on a corner, we need to get the dimensions of the screenlocal screenWidth, screenHeight = guiGetScreenSize()
-- Let's create a new browser in remote modelocal window = guiCreateWindow(screenWidth / 2, 0, screenWidth / 2, screenHeight / 2, "Web Browser", false)local browser = guiCreateBrowser(0, 28, screenWidth / 2, screenHeight / 2, false, false, false, window)local theBrowser = guiGetBrowser(browser) -- Get the browser element from gui-browser
-- Let's create a new command to check if youtube is loaded and load it if isntaddCommandHandler("isyoutubeloaded", function() if getBrowserURL(theBrowser) == "" then -- If the browser didnt load anything yet, load youtube outputChatBox("Youtube isn't loaded yet, loading it now....") loadBrowserURL(theBrowser, "https://www.youtube.com/") else -- If the browser loaded something outputChatBox("Youtube is loaded.") endend)See Also
Browser Functions
- canBrowserNavigateBack
- canBrowserNavigateForward
- createBrowser
- executeBrowserJavascript
- focusBrowser
- getBrowserProperty
- getBrowserSettings
- getBrowserSource
- getBrowserTitle
- getBrowserURL
- injectBrowserMouseDown
- injectBrowserMouseMove
- injectBrowserMouseUp
- injectBrowserMouseWheel
- isBrowserDomainBlocked
- isBrowserFocused
- isBrowserGPUEnabled
- isBrowserLoading
- isBrowserRenderingPaused
- loadBrowserURL
- navigateBrowserBack
- navigateBrowserForward
- reloadBrowserPage
- requestBrowserDomains
- resizeBrowser
- setBrowserAjaxHandler
- setBrowserProperty
- setBrowserRenderingPaused
- setBrowserVolume
- toggleBrowserDevTools