Reputation: 66276
I am hosting an OAuth page in an embedded browser. I want to close the login page as soon as possible without waiting for the redirect page to load (the OAUth provider requires a valid redirect url).
How do I detect navigation to the redirect url? OnBeforeNavigate fires for one url, but OnNavigateComplete for the final url, and it (obviously) takes time to navigate and load the page. I would prefer to skip that step by detecting redirect and bailing out before the browser actually hits the final redirect page.
Thanks!
Upvotes: 0
Views: 410
Reputation: 15281
In the host implementation of IDocHostUIHandler::GetHostInfo, turn on the DOCHOSTUIFLAG_ENABLE_REDIRECT_NOTIFICATION flag. You will then get a DWebBrowserEvents2::BeforeNavigate2 for each redirect, and can cancel a redirect if you want.
Upvotes: 3