client side data
Added by Mohammed Rashad over 14 years ago
How to do processing on a client side data or device
I have a Wt application which accepts some data from user.
I want the data to be processed client side without uploading data to server
Is this possible on web using Wt?
Replies (5)
RE: client side data - Added by Wim Dumon over 14 years ago
Yes, see examples/javascript for a simple example.
You can use:
- WApplication::require() to load a JS file containing the functions that process data
- JSignal to call C code from JavaScript (use createCall or trigger using Wt.emit())
- Use a JSlot to execute JavaScript when an event triggers it. You can trigger a JSlot by connecting it to a signal, but you can also trigger it from C by calling its exec method.
- As alternative to JSlot, use EventSignal::connect() to execute JS when an event happens (e.g. WPushButton::clicked().connect(function(object, event) { alert('hello!');}\")
- WWebWidget::doJavaScript() and WApplication::doJavaScript() allow you to execute JS from C
Some of this is demonstrated in examples/javascript.
Wim.
RE: client side data - Added by Mohammed Rashad over 14 years ago
i think my question is not complete that you have misunderstood.
my requirement is this
i ask user to select a file location on his system
without uploading to server i need to run a command on his system based on the file location he choose and send the result back to my wt application or store the result is server
RE: client side data - Added by Wim Dumon over 14 years ago
Browsers generally don't allow this, because it is a security risk.
There are a couple of workarounds:
- JavaScript has a new API, that allows you to load the data from a local file and process it in JavaScript.
- Use a trusted Java applet, so that you can access the file
- I believe ActiveX can also do this, but that is an IE on Windows only solution.
W.
RE: client side data - Added by Mohammed Rashad over 14 years ago
JavaScript has a new API, that allows you to load the data from a local file and process it in JavaScript.
Please tell me more about new JS API
Use a trusted Java applet, so that you can access the file
dont like to use a java applet
I believe ActiveX can also do this, but that is an IE on Windows only solution.
windows only solution is not suitable for me