How to block URLs in Cefsharp browser #4645
Unanswered
Aravind-pro
asked this question in
Q&A
Replies: 1 comment
-
Please no images of code see https://github.com/cefsharp/CefSharp/wiki/Questions-&-Support#no-images-of-code Use public class CustomRequestHandler : CefSharp.Handler.RequestHandler
{
protected override bool OnBeforeBrowse(IWebBrowser chromiumWebBrowser, IBrowser browser, IFrame frame, IRequest request, bool userGesture, bool isRedirect)
{
// Perform Url validation here.
if (request.Url == "SomeUrl")
{
//Do something here if required e.g. LoadUrl
//Return true tocancel the request
return true;
}
return base.OnBeforeBrowse(chromiumWebBrowser, browser, frame, request, userGesture, isRedirect);
}
}
chromiumWebBrowser.RequestHandler = new CustomRequestHandler();
If your new to |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have made a cef browser in winforms and i have found a way to block urls .

In this , if betonline.ag is opened , it should redirect to newUrl i set. It worked but still the site can be loaded in browser.
How can i add more instances of the url i want to block in one block of code itself?. Can i add more urls in the if condition?
Beta Was this translation helpful? Give feedback.
All reactions