desktop webkit equivalent of Android's addJavascriptInterface()?

让人想犯罪 __ 提交于 2019-12-22 08:46:50

问题


While researching Android UI possibilities, I came across documentation for a method called addJavascriptInterface() that allows you to expose methods on an Android Java object to the Javascript in a WebView component of your UI.

This idea seems so useful and obvious (in terms of concept, not implementation). However, I cannot seem to find any equivalent for a desktop version of the webkit engine. There are things out there like pywebkitgtk and qt's version of a webview that allow some limited communication between the native app and the web app, but they all seem to require funky hacks and homegrown messaging layers. The Android way is much more elegant.

Does anybody know of a similarly simple way one might go about bridging a HTML5 application with native desktop code?


回答1:


While looking for similar functionality, I came across several options:

  • Appcelerator's Titanium Desktop
  • Use Google's Web Toolkit for desktop app development, see this SO question.
  • Adobe Air
  • HTML5 for desktop app development - Another SO question which has several similar answers.

It seems like several different communities are converging on this type of functionality, further blurring the line between the desktop and the web.



来源:https://stackoverflow.com/questions/6483295/desktop-webkit-equivalent-of-androids-addjavascriptinterface

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