wxWebView doesn't trigger EVT_WEBVIEW_NAVIGATING

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
josuegomes
In need of some credit
In need of some credit
Posts: 2
Joined: Fri Aug 10, 2018 4:50 pm

wxWebView doesn't trigger EVT_WEBVIEW_NAVIGATING

Post by josuegomes »

Hi,

I tried to submit a ticket but trac is down.

Summary: On Windows wxWbView doesn't trigger EVT_WEBVIEW_NAVIGATING event
Description: with IE backend the event EVT_WEBVIEW_NAVIGATING is not triggered on a page redirection.
Steps to reproduce:
1. Build webview sample
2. Launch webview sample
3. Visit "https://google.com"

On Linux with GTK+ you'll see the events (the second 'Navigation request' is the redirection)

Code: Select all

13:41:06: Navigation request to 'https://google.com/' (target='')
13:41:07: Navigation request to 'https://www.google.com/' (target='')
13:41:07: Navigation complete; url='https://www.google.com/'
On Windows you'll only see the event:

Code: Select all

13:41:32: Navigation request to 'https://google.com/' (target='')
13:41:33: Navigation complete; url='https://www.google.com/'
Fix: add DOCHOSTUIFLAG_ENABLE_REDIRECT_NOTIFICATION flag in DocHostUIHandler::GetHostInfo (webview_ie.cpp)

See patch below:

Code: Select all

diff --git a/src/msw/webview_ie.cpp b/src/msw/webview_ie.cpp
index 46f7f410e0..43f97a52ce 100644
--- a/src/msw/webview_ie.cpp
+++ b/src/msw/webview_ie.cpp
@@ -31,6 +31,10 @@
 #include <initguid.h>
 #include <wininet.h>
 
+#ifndef DOCHOSTUIFLAG_ENABLE_REDIRECT_NOTIFICATION
+#define DOCHOSTUIFLAG_ENABLE_REDIRECT_NOTIFICATION  0x04000000
+#endif
+
 /* These GUID definitions are our own implementation to support interfaces
  * normally in urlmon.h. See include/wx/msw/webview_ie.h
  */
@@ -1629,7 +1633,7 @@ HRESULT wxSTDCALL DocHostUIHandler::ShowContextMenu(DWORD dwID, POINT *ppt,
 HRESULT wxSTDCALL DocHostUIHandler::GetHostInfo(DOCHOSTUIINFO *pInfo)
 {
     //don't show 3d border and enable themes.
-    pInfo->dwFlags = pInfo->dwFlags | DOCHOSTUIFLAG_NO3DBORDER | DOCHOSTUIFLAG_THEME;
+    pInfo->dwFlags = pInfo->dwFlags | DOCHOSTUIFLAG_NO3DBORDER | DOCHOSTUIFLAG_THEME | DOCHOSTUIFLAG_ENABLE_REDIRECT_NOTIFICATION;
     return S_OK;
 }
 
catalin
Moderator
Moderator
Posts: 1618
Joined: Wed Nov 12, 2008 7:23 am
Location: Romania

Re: wxWebView doesn't trigger EVT_WEBVIEW_NAVIGATING

Post by catalin »

Trac is not down, here at least. You can also open a PR on github.
josuegomes
In need of some credit
In need of some credit
Posts: 2
Joined: Fri Aug 10, 2018 4:50 pm

Re: wxWebView doesn't trigger EVT_WEBVIEW_NAVIGATING

Post by josuegomes »

Post Reply