Controlling Arduino from the remote server?

  1. I create a web home page.

Hosted where?

  1. My friend opens the web page using a browser.

OK.

  1. There is a button. If the button is pressed, it will check if an Arduino is connected to my friend's PC or not.

What will? If the button is a submit button, the action field for the form defines what script, on what server, is executed. Where is that script located?

How will the server hosting that script know anything about what is attached to a client's computer?