Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the smallest embedded browser I can use in C++?

I need to build my application GUI using HTML/CSS/JavaScript with a C++ backend all cross platform. I made simple tests with QtWebKit, XULRunner and Mozilla.

Well from the simple testes I notice something that is very batters me and it is the deployment size of the browsers libs/framework. It's big: 8 MB and above.

Is there some kind of smaller embedded browser I missing?

like image 474
user63898 Avatar asked Aug 09 '09 13:08

user63898


3 Answers

I don't know about other platforms, but the smallest way to do it on Windows is by using the system built-in Web Browser Control. It's based on COM, which can be quite complicated to program for. Following code gets you a such a beast:

HWND htmlWindow = ::CreateWindowExA(
  dwExStyle,
  ATLAXWIN_CLASS,
  "about:blank",
  dwStyle,
  x, y, w, h,
  hwndParent,
  NULL,
  hInstance,
  NULL
);

CAxWindow2 helperWindow;
helperWindow.Attach(htmlWindow);
CComPtr<IWebBrowser2> theWebBrowserControl;
HRESULT hr = helperWindow.QueryControl(&theWebBrowserControl);

The above code sample is the fruit of multiple weeks of painfully trying to understand this COM thing. Well, hope you find it useful somehow...

Note: above sample depends on ATL (not MFC).

like image 190
StackedCrooked Avatar answered Oct 22 '22 11:10

StackedCrooked


I think dillo requires c calling conventions, but it might do for your needs. No javascript or flash, or or or, but it does support CSS.

On reading the question again, I see that you need javascript, which dillo does not currently support. Sorry.

like image 27
dmckee --- ex-moderator kitten Avatar answered Oct 22 '22 12:10

dmckee --- ex-moderator kitten


I have a suggestion that might solve the problem:

On Windows use IE control and on Linux use Mozilla(which will probably be available as a dynamic library that you can load).

This will make your app the smallest it can be but you'll have to create a wrapper around IE/Mozilla to deal with them easily from code and your HTML/CSS/JS will have to be cross-browser.

like image 1
Diaa Sami Avatar answered Oct 22 '22 11:10

Diaa Sami