DocumentComplete (Event)

Revision as of 12:38, 29 October 2023 by Pongo02 (talk | contribs) (Created page with "<onlyinclude>{{Event |name = DocumentComplete |arguments = String ''URL'' |description = Fired when the DHTML document finishes processing a SetBody |object = HtmlWindow }}</onlyinclude> {{clear floats}} {{Example|This code would fire when the document finishes loading: <syntaxhighlight lang="lua"> local HtmlService = game:service("HtmlService") local htmlWindow = HtmlService:NewWindow() htmlWindow.DocumentComplete:connect(function() htmlWind...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
DocumentComplete ( String URL )
Description Fired when the DHTML document finishes processing a SetBody
Member of: HtmlWindow


Example
This code would fire when the document finishes loading:
local HtmlService = game:service("HtmlService")
local htmlWindow = HtmlService:NewWindow()

htmlWindow.DocumentComplete:connect(function()
	htmlWindow:SetBody("Hello World!")
end)

htmlWindow:Show()
htmlWindow:Navigate()


Note: DocumentComplete is not required to set the contents of the window, but without it you are making a race condition for when you try to display something. I recommend debouncing an initial DocumentComplete in the case that you want to modify it's contents.