Ejemplo n.º 1
0
 private void AddCustomScheme(string scheme, ResolveWebResourceDelegate requestHandler)
 {
     // Because of WKWebView limitations, this can only be called during the constructor
     // before the first call to Show. To enforce this, it's private and is only called
     // in response to the constructor options.
     WebResourceRequestedCallback callback = (string url, out int numBytes, out string contentType) =>
     {
         var responseStream = requestHandler(url, out contentType, out Encoding encoding);
         if (responseStream == null)
         {
             // Webview should pass through request to normal handlers (e.g., network)
             // or handle as 404 otherwise
             numBytes = 0;
             return(default);
Ejemplo n.º 2
0
 private static extern void BlazorWebViewNative_AddCustomScheme(IntPtr blazorWebView, string scheme, WebResourceRequestedCallback requestHandler);