Search code examples
c++windowsvisual-studiobrowserwxwidgets

How to get a fully functional Web Browser embedded into my C++ application


I want to create an application that will be able to extract data (for separate processing & formatting) from a specific website whilst I'm browsing, and possibly to automatically retrieve some specific pages in the background.

The website itself doesn't matter here, but what it pertinent is that it is behind a login (so requires session/cookie management) and it uses a lot of Javascript (JQuery), and notably a lot of Ajax for live content. One saving grace though is that it doesn't use Flash.

I only need this application to run in a Windows environment, but need to support XP as well as 7. And I don't care which browser it is, as long as it is fully functional!

So, I'm trying to find the easiest way to embed a fully functional browser into my own C++ application. IDE of choice would be Visual Studio 2008/2010, although Borland C++ would also be an option. I'm ideally aiming to use WxWidgets (if I go the VS path) to manage the rest of the GUI, and don't want to program in C#/.net, or QT.

  • I found 'wxWebConnect', which did a lot of what I needed, but it doesn't support cookies/sessions, so that wasn't usable.
  • I tried the Microsoft Web Browser Com component, but that has rendering issues with complex sites.
  • The WebKit path for WX is abandoned.
  • The Borland WebBrowser component is also dated and doesn't render complex pages correctly.
  • And many of the search results I've found here and elsewhere are either out of date, don't deal with fully functional browsers, or use languages/platforms that aren't an option for me.

I'm quite sure there must a simple solution to this as I'm sure many others have already done something similar. I just can't find it at the moment! I've looked briefly at the Firefox/Chromium paths, which is probably the right area, but as yet I haven't been able to find a simple means of integrating/using them into my own WX project.


Solution

  • In wxWidgets 3.0 you can use wxWebView, which is a wrapper around the native HTML rendering engine with full support for CSS, JavaScript and so on. By default it will use the system IE engine but you can also use it with Chromium.