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

5

10

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?

Palatable answered 9/8, 2009 at 13:33 Comment(1)
Normally I am very pro Qt, but since you need small, try looking at regular Webkit, (not QtWebkit), because the Qt bindings (along with the Qt library) may be adding unnecessarily to the size.Ragman
S
4

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.

Sharpset answered 9/8, 2009 at 14:37 Comment(0)
F
6

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

Forgot answered 9/8, 2009 at 18:47 Comment(0)
S
4

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.

Sharpset answered 9/8, 2009 at 14:37 Comment(0)
H
1

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.

Heterozygous answered 9/8, 2009 at 14:36 Comment(0)
S
0

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.

Sigismundo answered 9/8, 2009 at 19:16 Comment(0)
P
0

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.

Padraig answered 10/8, 2009 at 9:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.