Currently, there is a program that sends data using javascript postMessage when you enter a value in a form made with html and press the submit button.
I want to receive data from outside the server and send it in the future, but I can't find a good idea. It's fine, but is there a good way?
* It may not be well organized what I want to say, but please be kind.

What I tried

I put the javascript description in php and ran php, but it didn't work. Is it not possible to execute it unless the browser is started?

Supplementary information (FW/tool version, etc.)

I am using a linux server.

  • Answer # 1

    There is a program that sends data using javascript postMessage.

    postMessageIsProvided by the browserIt is a function, so you need to do it from your browser.

    In addition, the environment where JavaScript works is not limited to the browser, but there are other environments such as Node.js and Google Apps Script. However, the functions that can be used differ depending on the environment, so rewriting is necessary.

  • Answer # 2

    Receive data from outside the server

    Receiving data from outside the server is difficult with just the client js as CORS issues remain.
    On the contrary, if there is no problem with CORS, it is just a postMessage.
    If you process with iframe or worker, you will be able to js