I am currently evaluating various approaches / solutions for calling C ++ functions from JavaScript code embedded in an HTML page. The application must be running on the Ubuntu 12.04 LTS server.
I am not an expert in Linux development. This is the first time I'm trying to work on something to interact between JavaScript and C ++ code.
C ++ code is mainly located in .so files (dynamic libraries) that provide interface methods for accessing certain equipment and the file system. The GUI should be in HTML, and I'm looking for various possible solutions that C ++ can call from HTML. I searched and decided to solve two approaches using the WebKit mechanism.
Approach 1: Using Qt 5.0.2 Webkit Bridge - A WebView Control
The GUI framework will be based on Qt, the main application window will contain a webview control that will run HTML code, which in turn will contain JavaScript code.
The interface between the web page and C ++ is done using the addToJavaScriptWindowObject () function.
I created a sample application and tested this solution and it works fine.
Approach 2: Using GTK + WebKit WebView
I downloaded and installed the GTK 3.0 library.
I got webkitgtk 2.0.1 and installed it.
I created a test application with GTK without webkit, it works well.
I am trying to create webkit web control using GTK.
When I tried my approach 1 with Qt, there was a good enough set of documentation and samples to do what I wanted. But starting from approach 2, using GTK +, I feel like I'm moving slower compared. I personally think that part of the documentation is not so straightforward for the application I'm trying to develop.
Other approaches:
I also want to try to check whether you can use applets (directly access .so files) or use the JavaScript V8 engine for interaction between JavaScript and C ++ ( https://code.google.com/p/v8/ )
I tried the following resources:
http://webkitgtk.org/
http://www.webkit.org/
https://live.gnome.org/WebKitGtk/ProgrammingGuide/Tutorial
I want to know exactly how to make this part of the interface for calling C ++ functions (in .so files) when a button is clicked on an HTML web page containing JavaScript. What signal should I look for. If I use a WebkitWebview control, how do I display a button, click the C ++ button?
Can someone point me in the right direction?
I would really appreciate your time and knowledge.
Sincerely.