Steve
Steve

Reputation: 2520

Passing data from browser Javascript to Delphi application

I have a Google Sheets document containing invoicing data and an invoicing software written in Delphi 7.

What I'd like to achieve is to pass invoice data from the selected row in the sheet to the invoicing software. In order to do this, I plan to implement a simple javascript in the Google Sheet document.

The question is: is it possible for this in-browser javascript to pass data to my invoicing software?

Upvotes: 1

Views: 546

Answers (2)

Salvador Díaz Fau
Salvador Díaz Fau

Reputation: 1132

Another way to send any data from JavaScript to Delphi is adding CEF4Delphi to your Delphi invoicing software.

The JSExtension demo shows how to register customized JavaScript functions that execute Delphi code and send the results to your invoicing software.

Upvotes: 1

pschichtel
pschichtel

Reputation: 779

A simple solution would be to have the invoicing software start a small webserver that can take Cross-Origin-AJAX requests from the the JavaScript in the browser. This way the JavaScript could just send an POST request to e.g. http://localhost:8080/invoice

Another method would be to have register the invoicing software with a custom protocol and have the JavaScript open a new tab with that protocol and the data encoded into the URL. (How to do this on Windows)

If the invoicing software is not under your control, which I assumed, then neither of these approaches will work unless the software does already support this.

Upvotes: 1

Related Questions