Embedded IE browser: how to detect redirect before navigation completes?

妖精的绣舞 提交于 2019-12-12 02:14:55

问题


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!


回答1:


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.



来源:https://stackoverflow.com/questions/42637939/embedded-ie-browser-how-to-detect-redirect-before-navigation-completes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!