• Getting the URL of a HTML box
    5 replies, posted
If you have a HTML box, and its set to display a link, then you change the page using a link in that first link, how can I tell Lua that the page has been changed, and what it's been changed to, or is this not possible?
HTML:GetTable().CurrentURL I think.
[U][B]Next goal:[/B][/U] Become |FlapJack|. Thank you. Very useful. [URL="http://www.facepunch.com/member.php?u=231355"][/URL]
[QUOTE=|FlapJack|;23235865]HTML:GetTable().CurrentURL I think.[/QUOTE] Thankss =] But how do I get when that changes, so when someone changes the current URL it does a function. Or do I just have to check it every few seconds or so?
[QUOTE=Drakehawke;23237205]Thankss =] But how do I get when that changes, so when someone changes the current URL it does a function. Or do I just have to check it every few seconds or so?[/QUOTE] [lua]local HTMLPanels = {} function AddHTMLURLCallback(panel , func) table.insert(HTMLPanels , {panel = panel , func = func}) end local function CheckHTMLPanels() for k , v in pairs(HTMLPanels) do if v.panel and v.panel:IsValid() then if not v.LastURL then v.LastURL = v:GetTable().CurrentURL end if v:GetTable().CurrentURL != v.LastURL then v.func(v:GetTable().CurrentURL) v.LastURL = v:GetTable().CurrentURl end else HTMLPanels[k] = nil end end end hook.Add("Think" , "CheckHTMLPanels" , CheckHTMLPanels)[/lua] Should work.
Edit: Nevermind, figured it out.
Sorry, you need to Log In to post a reply to this thread.