• HTML not updating title.
    1 replies, posted
I know, this is more of a JavaScript + C++ questions, but since it's related to Garry's Mod and Lua, I thought I should post here. I have an HTML window with :[B]PageTitleChanged[/B]() method set to [B]print[/B]() (some debug needed, so it's [B]print[/B]() in my situation). I also have a page, generated with [B]audio.js [/B]JavaSecript script. I modified its code a bit to make the title change to the [B]time:duration[/B] of the player. It does work on Desktop browsers (#1), but when it comes to Gmod, it doesn't do anything (#2). The second screenshot was taken after about a minute of the song has passed. It should have produced a long column of numbers, starting from [B]0:248[/B], representing [B]time:duration[/B] pairs. Why does my title not update using a tick javascript function happen? Oh, and the counter goes right. In that function I edited there's a call that changes time value of the player (#3), which makes me sure about whether the event is called or not. The edited audio.js snippet is #4. I might have missed some of the function's name, but that doesn't really change the point. EDIT: I've posted Lua code as #5. If you want to check whether the player is working or not, go to the link from #6. Ref #1: [IMG]http://cloud.alryaz.com/screenshots/fxWbRfbG.jpg[/IMG] Ref #2: [IMG]http://cloud.alryaz.com/screenshots/cESarofr.jpg[/IMG] Ref #3: [IMG]http://cloud.alryaz.com/screenshots/41laIO6E.jpg[/IMG] Ref #4: [CODE] events.addListener(a.element,"timeupdate",function(){ document.title=Math.round(this.currentTime)+':'+Math.round(this.duration); a.updatePlayhead.apply(a) }); [/CODE] Ref #5: [CODE] concommand.Add('createplayer',function() local frame = vgui.Create('DFrame') frame:SetSize(200,100) frame:SetTitle('Player') frame:Center() frame:MakePopup() local html = vgui.Create('HTML',frame) html:OpenURL('http://cloud.alryaz.com/radio/') html:SetSize(200,75) html:SetPos(0,25) html.PageTitleChanged = print end) [/CODE] Ref #6: [url]http://cloud.alryaz.com/radio/[/url]
Steam browser can be "special" at times, make sure that title is really changed. Also, post the lua code.
Sorry, you need to Log In to post a reply to this thread.