Domanda

I'm using WebKitGTK+ ( WebKit ) application that will be a very simple web browser running in a Linux environment as a separate executable that will need to exchange data between another application. The system is described in the following image:

enter image description here

Example scenario:

  • Event such as smart card insertion detected in Backend processing Application
  • smart card data is read and passed to the WebKitGTK+ GUI Application
  • User interacts with "web page" displayed in WebKitGTK+ Application
  • Data is passed from WebKitGTK+ Application back to the Backend processing Application

What are the common methods of passing data between the WebKitGTK+ Application and the Backend processing Application?

Does `WebKitGTK+ provide some hooks to do this sort of thing? Any help at all would be appreciated.

È stato utile?

Soluzione

I know this is a old question, but will try to answer it to best of my abilities so that it can be useful to someone else.

Webkit is basically rendering a html page. You can connect to various signals that webkit provides and act on these signals. More details at http://webkitgtk.org/reference/webkitgtk/stable/webkitgtk-webkitwebview.html

For your back end application, if something interesting happens, you can update page either by navigating to a new url, new page contents or just by setting text of desired element. Webkit provides DOM api functions and all of these are possible.

It becomes interesting when getting data from webkit and sending it to your back end system. Again, this depends upon your specific design, but generally you can hook up signals such as navigation signals when user clicks on a button and get contents. Another alternative is to use alert handler and simply use javascript alert and process the alert data on backend side.

Shameless plug for example : https://github.com/nhrdl/notesMD. It uses a simple database backend, probably can be good use case as it sends data back and forth between database and webpage. Even manipulates the links so that desired actions take place.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top