Skip to content

mganss/AsyncPluggableProtocol

Repository files navigation

Handle custom protocol schemes when you are using the WebBrowser control in a Windows Forms (or WPF) desktop application.

ProtocolFactory.Register("rsrc", () => new ResourceProtocol());
var html = @"<html><body style=""background-image: url(rsrc:helloworld.png)""></body></html>";
Browser.DocumentText = html;

The ResourceProtocol class in the example above implements the following interface to deliver embedded resources to the browser control:

public interface IProtocol
{
    string Name { get; }
    Task<Stream> GetStreamAsync(string url);
}

About

C# Asynchronous Pluggable Protocol Handler

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages