How to embed a web browser control in a cross-platform application?

懵懂的女人 提交于 2019-11-29 14:57:20

问题


I need to write quickly this application: a simple window that wraps a web browser control, that runs html pages. The Browser UI (e.g. Navigation buttons) should be suppressed.

As a .net developer, I would embed the WebBrowser OCX in a Windows Form. But this has to run on Mac as well!

I found the following cross-platform candidates. Which one would you choose (in terms of simplicity, stableness, community support, etc.):

  1. wxWidgets: http://www.kirix.com/labs/wxwebconnect.html

  2. QT: http://www.youtube.com/watch?v=Ee8eRwjbcFk&feature=related

  3. MONO: http://www.mono-project.com/WebBrowser


回答1:


Why not to use embedded Webkit?




回答2:


QtWebkit:

The Qt port of WebKit currently compiles and runs on Linux (including Maemo), Windows, Mac OS X and Symbian.

Click here for build instructions.

A very simple test browser is built along with the port.




回答3:


Since you have (assumption made from your post) .Net experience I'd go with Mono.

Have you considered Adobe AIR? http://www.adobe.com/products/air/




回答4:


Mono is probably the best choice if you're primarily a .NET developer and don't care very much about making a well-integrated Mac app (one that behaves like a Mac app in all the many ways Mac users expect). Given your problem space, that sounds like where you are. That said, pay special attention to this limitation from the WebBrowser page if it applies to your problem:

The Mono Webbrowser currently lacks support for window.external, the bridge that allows Javascript code embedded in the browser to communicate with the managed world using the ObjectForScripting.

QT is very well established, and a great platform if you want to develop this in C++. Remember that there are licensing fees if this is a commercial app.

I've played a bit with wxWidgets. It's big advantage here is that it's probably going to be the smallest distribution, since you only have to include what you need. If all you need is the web browser, I'd look at this, but in my experience it's hard to make wxWidgets programs look good or act correctly on Mac (or on Windows for that matter).




回答5:


Another option may be to write it as a Java app using the Eclipse Standard Widget Toolkit. This includes a browser control that embeds IE, Safari or Firefox, depending on the current platform, and generally behaves well on OS X.



来源:https://stackoverflow.com/questions/2721201/how-to-embed-a-web-browser-control-in-a-cross-platform-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!