Send data from TChromium to delphi application

1,857 views
Skip to first unread message

Martin

unread,
Dec 20, 2011, 12:18:12 PM12/20/11
to delphichromiumembedded
I need to send data by javascript from TChromium to delphi
application, is it possible? How?

I have a html page with a form, the user fill the form then click on a
button. The button call a javascript function that use the form data
to make some operation then I need send these results (2 strings and 2
numbers) to my delphi application.

Is there a way?

thanks

Christian Sciberras

unread,
Dec 20, 2011, 12:43:09 PM12/20/11
to delphichrom...@googlegroups.com
This question is asked at least once every week.
Can you please search first??

Anderson Dapper

unread,
Dec 20, 2011, 1:11:38 PM12/20/11
to delphichrom...@googlegroups.com
Who want help to create a page of this in Wiki space of code.google project???

Someone talk with Henri Gourvest????

Att,
Anderson Dapper Rocha



2011/12/20 Christian Sciberras <uuf...@gmail.com>

Henri Gourvest

unread,
Dec 20, 2011, 3:46:24 PM12/20/11
to delphichrom...@googlegroups.com

I still have an eye on this group, if some one want to write something on the wiki he is welcome.
--
Henri Gourvest

Anderson Dapper

unread,
Dec 20, 2011, 9:38:32 PM12/20/11
to delphichrom...@googlegroups.com
I want but my english is very poor! I'm brazilian!

I use the Delphi Chromium on my business projects and I know about the basics of implementation on delphi source code, I help to write but I need someone to check spell!

Att,
Anderson Dapper Rocha



2011/12/20 Henri Gourvest <hgou...@gmail.com>

Martin

unread,
May 17, 2012, 5:47:11 PM5/17/12
to delphichrom...@googlegroups.com
I just have find on this group and see the cefclient example.

I have understand I need use TExtension but I don't understand how.

I need call from Javascript a delphi procedure with 6 string parameters.

Can you help me with a small example?

Thanks

Kaxap Kashimov

unread,
May 17, 2012, 6:51:21 PM5/17/12
to delphichrom...@googlegroups.com
The simpliest way is to use JS' alert() function and handle it with
OnJsAlert event handler.

Martin

unread,
May 18, 2012, 3:31:07 AM5/18/12
to delphichrom...@googlegroups.com
Is this a safe mode? Or I need use TExtension to do it without problem?

Martin

unread,
May 18, 2012, 3:37:54 AM5/18/12
to delphichrom...@googlegroups.com
I must pass this parameters many time, for this reason I don't know if alert() is a good method.

Kaxap Kashimov

unread,
May 18, 2012, 9:31:04 AM5/18/12
to delphichrom...@googlegroups.com
The method with the alert() is

call "alert('parameter_name:value');" from JS, then in OnJsAlert handler

//JS code may call alert to pass an event to application
//should contain prefix and body
Result := False;
i := Pos(':', message);
if i < 0 then
Exit;

//get prefix and boy of alert message
pref := Copy(message, 1, i);
body := Copy(message, i + 1, Length(message));

if (pref = PARAMETER_NAME) then ...

It works as intended so far.

About using extension class:
http://stackoverflow.com/questions/6893029/how-to-expose-native-functions-to-javascript-in-a-web-page-using-chromium-and
Reply all
Reply to author
Forward
0 new messages