Search the Community
Showing results for tags 'executebrowserjavascript'.
-
Hi! l need help exporting data from 'GetElementData' using executeBrowserJavascript Here is a snippet from the code: Client: local browser = guiGetBrowser(guiCreateBrowser(0, 0, 1920, 1080, true, true, true)) addEventHandler("onClientBrowserCreated", browser, function () loadBrowserURL(source, "http://mta/account/Characters/MainMenuChar.html") showCursor(true) setDevelopmentMode(true, true) end) addEventHandler("onClientBrowserDocumentReady", browser, function () executeBrowserJavascript(source, "document.getElementById('nickname').innerHTML = '" .. getElementData(thePed,"account:charselect:name") .. "'"); end) it does not work with CEF(HTML) files, when you call 'GetElementData' using the GUI, everything works and is displayed correctly. When entering a standart varible, for example getPlayerName(localplayer) everything is also displayed in CEF and in the GUI Problems with the HTML file are excluded, except that there are no additional scripts using JavaScript (tell me, are they required?) P.S Thank you in advance for each of your answers, maybe they will help not only me, but also other newcomers in our community
- 2 replies
-
- getelementdata
- html
-
(and 1 more)
Tagged with:
-
Hello I have an issue when I trigger an event that call a function using onClientBrowserDocumentReady, i don't know what is the issue... This is my code: The issue is... onClientBrowserDocumentReady doesn't found the browser and it can't in into the event. the executeBrowserJavascript doesn't work event = {add = addEventHandler, load = addEvent, execute = triggerServerEvent} local WINDOW_WIDTH, WINDOW_HEIGHT = guiGetScreenSize() local CEF = nil local browser = nil function deleteWebPage() if isElement(CEF) then destroyElement(CEF) showCursor(false) end end function createWebPage() page = "http://mta/player/html/login.html" CEF = guiCreateBrowser(0, 0, WINDOW_WIDTH, WINDOW_HEIGHT, true, false, false) browser = guiGetBrowser(CEF) addEventHandler("onClientBrowserCreated", browser, function() loadBrowserURL(source, page) showCursor(true) end) end function sendErrorLabel(error) addEventHandler("onClientBrowserDocumentReady", browser, function() executeBrowserJavascript(browser, "document.querySelector('.error:nth-child(5)').innerHTML = '" .. error .. "'"); executeBrowserJavascript(browser, "document.querySelector('.error:nth-child(5)').style = 'display: initial; top: 90%; left:40.5%'"); end) end event.load('login-data:send', true) event.add('login-data:send', root, function(user, password) event.execute('login-menu:execute', resourceRoot, user, password) end, true) event.load("onClientPlayerLogout", true) event.add("onClientPlayerLogout", root, function() createWebPage() end) event.load("show-label:error", true) event.add("show-label:error", root, function(error) sendErrorLabel(error) end) event.load('login-menu:remove', true) event.add('login-menu:remove', root, function() deleteWebPage() end) event.add("onClientResourceStart", resourceRoot, function() createWebPage() end)
- 1 reply
-
- executebrowserjavascript
- onclientbrowserdocumentready
- (and 3 more)