Handling Redirects with OnBeforeBrowse and OnResourceRedirect

1,107 views
Skip to first unread message

Jim Richy

unread,
Nov 13, 2015, 9:59:15 AM11/13/15
to CefSharp
I'll start with how awesome CEFSharp has been to work with, great work all!!

So I have a situation where I need to control if the browser should navigate to a page or if something should happen in the native WPF app based on URL's being navigated to.  So I use OnBeforeBrowse and utilize the return value and all is good, until the server does a redirect.  I just upgraded to version 43.0.1 and so I have the OnResourceRedirect method and can see the the URL I'm being redirected to, but I can't stop the navigation at that point as far as I can tell.  I see that next I get a call to OnBeforeBrowse with the isRedirect flag set to true, presumably in response to the redirect.  But the request object is still referencing the original URL, which does make sense.  But I'm left without any knowledge of what I'm being redirected to, or at least as far as I can tell that's the situation.  Now what I did do is take the URL I got in OnResourceRedirect and save it for use in my OnBeforeBrowse.  So that appears to be working for me, but I don't have a real warm and fuzzy feeling about it. It seems like a setup that is likely to turn into a bug one day for me.  So I'm wondering if I'm missing something, is there a property I'm missing in OnBeforeBrowse to see what I was redirected too?  Or is there a way to stop the navigation from OnResourceRedirect?

Thanks
Jim

Alex Maitland

unread,
Nov 16, 2015, 5:28:40 AM11/16/15
to CefSharp
Reply all
Reply to author
Forward
0 new messages