Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Jun 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Executing Java command to another device

    Not sure how to phrase the question, we have a number of projectors which you can access a web interface for. On the page it features the ability to turn the projector off using the javascript:

    Code:
    <script language="JavaScript"><!--
    function rbt(){}
    s=0;
    function f(w){
     if(s==0){
      if(!w){
       a=confirm('Turn to standby?');
       if(!a)
        return false;
      }
      s=1;
      return true;
     }else{
      alert("Processing...");
      return false;
     }
    }
     --></script>
    What I want to do is have one page with on/off buttons for each projector so one button would access the projector 10.210.206.10 and execute the command to turn it off. The next button would turn 10.210.206.11 off, etc.

    This sounds like it should be a simple solution but I can't think.

    Thanks

  • #2
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,479
    Thanks
    6
    Thanked 981 Times in 954 Posts
    You’re talking about JavaScript, baby. You can’t access anything with JS other than your browser object. There is much more to it if you want to control external devices. The JS part can only be responsible for the user interface, not for the shut down of a device.

  • #3
    New to the CF scene
    Join Date
    Jun 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by VIPStephan View Post
    Youíre talking about JavaScript, baby. You canít access anything with JS other than your browser object. There is much more to it if you want to control external devices. The JS part can only be responsible for the user interface, not for the shut down of a device.
    I see, thanks for your help.

    Have to look at something else then!

  • #4
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,188
    Thanks
    10
    Thanked 569 Times in 550 Posts
    just make a page with several iframes framing the individual projector pages.
    you can also talk between iframes, so in theory at least, the tabs can send each other a single command.

    javascript can talk to other IPs, within a set of limits known as the same origin policy.
    since that only applies to fetching info, any js can pretty much ping any url/ip; it just can't confirm that the target was reached without explicit co-operation by the other end.
    i'm not sure how the projector IP address receives commands, so i can't tell you that your idea WILL work, only that it's certainly possible that it CAN work.
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/1/19) IE7:0.2, IE8:6.7, IE11:7.4, IE9:3.8, IE10:4.4, FF:18.3, CH:43.6, SF:7.8, MOBILE:27.5


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •