How to effectively package a headless browser?

I am developing desktop software for a client and considering using web technologies like HTML5 and JavaScript for the UI. I plan to bundle a headless version of a modern browser, such as Chrome or Firefox, with my software. This means including only the page-rendering engine, without the typical browser elements like borders, menus, tabs, shortcuts, or profiles. What is the simplest way to achieve this in a platform-independent manner? I remember Mozilla had projects like Prism and Chromeless, but they haven’t been updated in a long time.

Considering the goal to use HTML5 and JavaScript for the UI in a cross-platform desktop app, another practical solution is to employ Electron.js. This framework wraps a modern Chromium engine alongside Node.js, allowing robust and dynamic interfaces and making it simpler to bundle without external dependencies. It is a proven approach with significant community and documentation support. Alternatively, look at the Chromium Embedded Framework (CEF) for more flexibility and control over the rendering engine, though you may find it more complex to set up initially. Be mindful of licensing requirements and the trade-off between ease of deployment and application size.

You might also want to consider using NW.js (previously known as Node-Webkit) for packaging a headless browser in your application. NW.js offers the ability to use Node.js modules directly from the DOM and provides integration with the native operating system’s APIs. This can give you the benefits of powerful Chromium engine alongside the flexibility of Node.js without the overhead complexity that CEF might bring.

Additionally, NW.js supports running both in headless and GUI modes, making it versatile depending on your needs. While it does have a similar size trade-off to Electron, it allows for a very efficient and tidy bundling of your development environment.

Keep in mind, if platform independence is a major concern, NW.js supports Windows, macOS, and Linux, just like Electron. Do consider exploring this option depending on the specific needs and constraints of your project.

You could also try Tcl/Tk with its TkHTML or WebkitGTK. They provide a simpler setup and smaller size for embedding web rendering capabilities. Not as feature-rich as Electron but might meet your needs for a lightweight solution!