WebPanel doesn't seem to work.

Started by FangStriker 2 posts 40 views

Reply on sbox.game
  1. #1
    FangStriker 343
    I'm referencing a WebPanel through a razor panel. The WebPanel class is loading correctly and no errors are being thrown, however the webpage requested doesn't actually visually display in the UI. I'm using example.com as a test and nothing shows.

    using Sandbox;
    using Sandbox.UI;

    public class BrowserPanel : WebPanel
    {
        public const string DefaultUrl = "https://example.com";

        public BrowserPanel()
        {
            Style.Width = Length.Percent( 100 );
            Style.Height = Length.Percent( 100 );
            Style.BackgroundColor = Color.Black.WithAlpha( 0.15f );
        }

        public void Navigate( string url )
        {
            Url = string.IsNullOrWhiteSpace( url ) ? DefaultUrl : url;
            Log.Info( $"Loading page: {Url}" );
        }

        public override void OnButtonEvent( ButtonEvent e )
        {
            // Optional: intercept inputs before/after base call
            // Example: close on Escape
            if ( e.Pressed && e.Button == "escape" )
            {
                Delete();
                return;
            }

            base.OnButtonEvent( e );
        }

        public override void OnKeyTyped( char k )
        {
            base.OnKeyTyped( k );

            Log.Info( $"Typed into web panel: {k}" );
        }

        protected override void OnFocus( PanelEvent e )
        {
            base.OnFocus( e );
            Log.Info( "Browser panel focused" );
        }

        protected override void OnBlur( PanelEvent e )
        {
            base.OnBlur( e );
            Log.Info( "Browser panel lost focus" );
        }

        public override void OnDeleted()
        {
            base.OnDeleted();
            Log.Info( "Browser panel deleted" );
        }
    }
  2. edited Apr 2026 #2
    FangStriker Started this 343
    I'd like to add that I just noticed today that the 'WebBrowser' does not work in the Widget Gallery either.

    Is this a known issue? Or is no one else having this issue?