Another custom tile question (Close tab)

So I learned a bunch from the volume slider, but thanks to @josh his amazing skills, I now took an interest to using the Javascript API for Fully Kiosk. But… I can’t get it to work.

I tried a simple close tab script, but it’s not working. I simply tried a button code with the request in it, tried to use function like below, nothing. From reading Fully kiosk website, this should work, no? I also tried int 1, doesn’t work either.
Looking at the volume slider script makes no bulbs light up in my head either :rofl:

<!-- Do not edit below -->
<script type="application/json" id="tile-settings">
{
  "schema": "0.1.0",
  "settings": [],
  "name": "JavaCloseTab",
  "label": {"display": false}
}
</script>
<!-- Do not edit above -->
<!DOCTYPE html>
<html>

<body>

  <script>
    
    function myFunction(){
  void fully.closeTabByIndex(1)
    
  }


</script>

<button onclick="myFunction">Stop radio</button>

  

</body>
</html>

Nobody an idea? Haven’t gotten any further on this.

A few ideas here, and hope these help.

  1. Missing the () in calling the function in onclick

    <button onclick="myFunction()">Stop radio</button>
    
  2. You don’t need the void to call the Fully’s method, the void just means it doesn’t return anything, and you may need to verify the index you need. (I would guess 0 to be the first tab.)

     function myFunction(){
         fully.closeTabByIndex(0);    
     }
    
  3. Don’t forget to check if the Enable Javascript Interface option is enabled in the Advanced Web Settings in Fully’s settings.

1 Like

I changed it but haven’t had time to test it out yet.

Will update tonight! :smiley: