我可以在 C++ 中使用的最小嵌入式浏览器是什么?

发布于 2024-08-01 12:47:09 字数 356 浏览 7 评论 0 原文

我需要使用 HTML/CSS/JavaScript 构建我的应用程序 GUI 具有 C++ 后端,所有跨平台。 我做了简单的测试 与 QtWebKitXULRunner 和 Mozilla。

从简单的睾丸中我注意到一些非常重要的东西 让我震惊的是浏览器的部署大小 库/框架。 它很大:8 MB 及以上。

我是否缺少某种较小的嵌入式浏览器?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

少跟Wǒ拽 2024-08-08 12:47:09

我认为 dillo 需要 c 调用约定,但它可能可以满足您的需求。 没有javascript或flash,或或或,但它确实支持CSS。

再次阅读问题时,我发现您需要 javascript,而 dillo 目前不支持 javascript。 对不起。

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.

亚希 2024-08-08 12:47:09

我不知道其他平台如何,但在 Windows 上执行此操作的最小方法是使用系统内置的 Web 浏览器控件。 它基于 COM,因此编程起来相当复杂。 下面的代码让你得到了这样一个野兽:

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

上面的代码示例是数周痛苦地尝试理解这个 COM 事物的成果。 好吧,希望您发现它在某种程度上有用...

注意:上面的示例取决于 ATL(而不是 MFC)。

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

清醇 2024-08-08 12:47:09

我有一个可能解决问题的建议:

在 Windows 上使用 IE 控件,在 Linux 上使用 Mozilla(它可能会作为可以加载的动态库提供)。

这将使您的应用程序尽可能最小,但您必须在 IE/Mozilla 周围创建一个包装器,以便通过代码轻松处理它们,并且您的 HTML/CSS/JS 必须是跨浏览器的。

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.

醉生梦死 2024-08-08 12:47:09

另一种方法,完全未经测试:将一个简单的网络服务器(例如 Boost::Asio 有关于此事的教程/示例)包含到您的程序中,也许在一个单独的线程中。 然后让用户选择的网络浏览器浏览到您的程序刚刚启动的网络服务器。

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.

浅笑轻吟梦一曲 2024-08-08 12:47:09

8 MB:您是在谈论文件(或闪存)大小吗? 我预计浏览器的操作内存要求比代码库更重要......但我在您的问题中没有看到这一点。 既然您指的是 Qtwebkit,您的产品中是否还有其他活跃的 Qt 库?

很大程度上取决于您的需求; 兼容性、CSS、屏幕尺寸、性能怎么样? 免费软件还是许可软件? 哪些许可条件(即 GPL 或绝对不是)。 你可以说得更详细点吗?

性能良好且符合标准的浏览器很容易花费 16+ MB。 我发现 Opera,特别是 opera devices 非常有趣; 它非常符合标准、可定制且高性能,但它的内存使用也在 16-32 MB 范围内。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文