Garry's Mod Wiki

Revision Difference

Panel:OpenURL#526838

<function name="OpenURL" parent="Panel" type="classfunc">⤶ <description>Instructs a HTML control to download and parse a HTML script using the passed URL.</description>⤶ <function name="OpenURL" parent="DHTML" type="panelfunc">⤶ <description>Instructs a HTML control to download and parse a HTML script using the passed URL.⤶ This function can also be used on [HTML](https://wiki.facepunch.com/gmod/HTML).</description>⤶ <realm>Client</realm> <args> <arg name="URL" type="string">URL to open</arg> </args> </function> <example> <description>Displays the Garry's Mod wiki page.</description> <code> local frame = vgui.Create( "DFrame" ) frame:SetTitle( "HTML Example" ) frame:SetSize( ScrW() * 0.75, ScrH() * 0.75 ) frame:Center() frame:MakePopup() local html = vgui.Create( "HTML", frame ) local html = vgui.Create( "DHTML", frame ) html:Dock( FILL ) html:OpenURL( "wiki.garrysmod.com" ) html:OpenURL( "wiki.facepunch.com/gmod" ) </code> </example> <example> <description>Displays the default loading screen from the html folder.</description> <description>Displays the default loading screen from the HTML folder.</description> <code> local frame = vgui.Create( "DFrame" ) frame:SetTitle( "HTML Example" ) frame:SetSize( ScrW() * 0.75, ScrH() * 0.75 ) frame:Center() frame:MakePopup() local html = vgui.Create( "HTML", frame ) html:Dock( FILL ) html:OpenURL( "asset://garrysmod/html/loading.html" ) </code> <output><image src="html_openurl_example.png" alt="800px"/></output> </example>