Chrome Extension x Delphi

2

Does anyone know how to communicate an extension created for CHROME with DELPHI?

How to send DELPHI commands to this extension OR vice versa?

Follow the extension code that captures the current ABA code.

function DOMtoString(document_root) {
    var html = '',
        node = document_root.firstChild;
    while (node) {
        switch (node.nodeType) {
        case Node.ELEMENT_NODE:
            html += node.outerHTML;
            break;
        case Node.TEXT_NODE:
            html += node.nodeValue;
            break;
        case Node.CDATA_SECTION_NODE:
            html += '<![CDATA[' + node.nodeValue + ']]>';
            break;
        case Node.COMMENT_NODE:
            html += '<!--' + node.nodeValue + '-->';
            break;
        case Node.DOCUMENT_TYPE_NODE:
            // (X)HTML documents are identified by public identifiers
            html += "<!DOCTYPE " + node.name + (node.publicId ? ' PUBLIC "' + node.publicId + '"' : '') + (!node.publicId && node.systemId ? ' SYSTEM' : '') + (node.systemId ? ' "' + node.systemId + '"' : '') + '>\n';
            break;
        }
        node = node.nextSibling;
    }
    return html;
}

chrome.extension.sendMessage({
    action: "getSource",
    source: DOMtoString(document)
});
    
asked by anonymous 16.05.2014 / 02:51

1 answer

2

It is not clear if you want to communicate with a program written in Delphi on the machine locally or remotely over the internet. In any case the solution is to open an HTTP server through Delphi and handle requests generated by the extension. In the extension you can send a POST request to the IP of the machine running the Delphi program (% with% if it is the computer itself). The server can be a CGI application, for example, by listening on a specific port that the extension knows about. That's the basic idea.

It seems to me that there are no other means (even for security reasons) of the extension accessing anything on the computer, whatever it may be. The only way to communicate would be with AJAX itself.

    
16.05.2014 / 03:08