Is it possible to make a CRON JOB run javascript?

Viewed 1030

Thank you in advance for your help, I am hoping I can explain what I'm doing and get feedback on if there's a different way I can do this.

My application is for a digital signage program. My cron runs every morning and accesses a weather api. It then creates a 1920x1080 div showing the weather using a PHP. On "page ready" it then uses a javascript library called HTML2CANVAS to convert that div to a canvas, then appends the canvas to a div, and then that canvas to a dataURL where it's finally posted an upload page. On that upload page it's added to the database for that signage player.

This works fine in cases when a user is converting a canvas, but I am told that crons cannot run javascript or won't run a "on page ready". Are there any ways at all around this?

<div class="preview" id="widget"> </div> ///the 1920x1080 weather div created using php 
<div id="canvas-out"></div> ///this is where the canvas is generated

<script>
$(document).ready (function(){
 html2canvas($("#widget"), {
        proxy: 'html2canvasproxy.php',
        onrendered: function(canvas) {
            canvas.id = "thecanvasid";
            theCanvas = canvas;
            document.body.appendChild(canvas);
            $("#img-out").append(canvas);

                var canvas = document.getElementById('thecanvasid');
                var dataURL = canvas.toDataURL();

                var uploadurl='upload.php';///this url converts the base url to a jpeg and uploads it 
                 $.post("demo_test_post.asp",{ data: uploadurl });

                } ///on rendered
        }); ///html2canvas

      });////document ready 
0 Answers
Related