www.webdeveloper.com
Results 1 to 2 of 2

Thread: Using JavaScript to create a Kiosk

  1. #1
    Join Date
    Apr 2013
    Posts
    1

    Using JavaScript to create a Kiosk

    I am trying to use JavaScript to create a KIOSK. It will display a page for a number of seconds and than another, w/o user interaction. I have come to the conclusion that this is not possible because the language lacks threads.

    The following two Perl scripts crudely approximates the desired behavior. One stands up the page the other knocks it down. Can JavaScript do what I need or will I have to resort to using something like Java? Any guidance would be greatly appreciated.

    #!/usr/bin/perl
    use strict;
    use warnings;
    while( 1 == 1){
    my $status = system('"C:\Program Files\Mozilla Firefox\firefox.exe" http://www.npr.org');
    system('"C:\Program Files\Mozilla Firefox\firefox.exe" http://www.pbs.org');
    }

    #!/usr/bin/perl
    use strict;
    use warnings;
    while( 1 == 1){
    sleep(15);
    my $status = system('taskkill /F /IM firefox.exe >nul 2>&1');
    }

  2. #2
    Join Date
    Jul 2008
    Location
    urbana, il
    Posts
    2,787
    you can use a <meta refresh is you don't trust JS...

    in js, it's very simple to schedule a page load, no threads needed:

    Code:
    setTimeout(function(){
      location.href='page2.thml';
    }, 1000 * 15);
    you sould customize and drop-in the script for each page.
    of course, you can make it fancier and centralized using an iframe that is styled with CSS to take up the full screen.

    Code:
    <style>
     /*needs more styles, this is a start */
     html, body, iframe { margin:0; padding: 0; overflow: hidden; }
    </style>
    <body>
    
    
    <iframe width="100%" style=height:500px id=frame1></iframe>
    <script>
    
    //the list of folder-relative pages to show:
    pages= ["page1.html", "page2.html", page3.html", "page4.html"];
    
    //this tracks the current page's numer in the array:
    index=0;
    
    
    function next(){ //the fn diplays the next page or first page if at the end:
       index++;
       if(!pages[index]){ index=0; }
       frame1.src=pages[index];
    }
    
    setInterval( next, 1000 * 15 ); //advance every 15,000 mili-seconds
    
    </script>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles