I think the interaction between these pages would work better on server-side instead of trying to do client-side with JavaScript.
You can store the results of these commands from page A in localStorage
or sessionStorage
, and get them on page B. Page B does what needs to be done and passes the result of operations to page C. The C page then returns to the user whether the operation was successful or not. There is a catch: this solution only works on a single device, since localStorage
and sessionStorage
are unique to the browser's JavaScript engine and can not be shared.
This closely resembles the MVC standard, but of course only JavaScript on the client-side is not the best way to implement it. I recommend you take a look at some programming language that can run servers such as PHP, Ruby or Java. If you want to continue using JavaScript, I recommend NodeJS to be able to use JavaScript on the server as well.
Seeing your comments, you can make two pages:
The page that is on the phone can send a command to the server;
The server reads this command;
Page B is periodically (every 5-10 seconds) asking the server for the result of the command. When this changes, the page changes its state.
This would be one of the many solutions that exist for your problem, and certainly not the best. I suggest you explain your problem a little better, and that detail plus what you want to do.