views:

518

answers:

5

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?

A: 

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.

Diaa Sami
+2  A: 

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.

dmckee
A: 

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).

StackedCrooked
A: 

Another approach, completely untested: Include a simple web-server (e.g. Boost::Asio has a tutorial/example on the matter) into your program, perhaps in a separate thread. Then let the user's choice of web browser surf to the web-server just started by your program.

Peter Jansson
A: 

The 8 MB: you're talking about file (or flash storage) size? I expect operational memory requirements of browsers to be more significant than the code base.... but I don't see this in your question. Since you're referring to Qtwebkit do you have other Qt libraries active in your product?

Depends a lot on your needs; how about compatibility ,CSS, screen size, performance? Free software or licensed? Which license conditions (i.e. GPL or definitely not). Can you be more specific?

A browser which is well performing and standards compliant will easily cost 16+ MByte. I found Opera, specifically opera devices very interesting; it is very standards compiant, customizable and performant, however it's memory use is also in the 16-32 MByte region.

Adriaan