Wednesday, 8 November 2017

Using JavaScript on embedded device (framebuffer)


I am trying to determine if netsurf is a viable option for a project targeting an embedded ARM7 processor with a framebuffer interface. I have successfully compiled netsurf with TARGET=framebuffer and copied to my target. Found that even though I had enabled using duktape, support for JavaScript was not enabled. I ended up enabling javascript by modifying js_initialize in dukky.c to set enable_javascript = true. Is there a better way of doing this? Also, is there any information available that describes which javascript features are supported? I am trying to use an onLoad function to show dynamic time in one of my html divs but that isn’t working. Also when I add a setTimeout to my onLoad function I get an error.

 

Any help would be much appreciated.

 

<script type="text/javascript" language="JavaScript">

   function startTime() {

      var today = new Date();

      var h = today.getHours();

      var m = today.getMinutes();

      var s = today.getSeconds();

      m = checkTime(m);

      s = checkTime(s);

      document.getElementById('clockTxt').innerHTML = h + ":" + m + ":" + s;

      var t = setTimeout(startTime, 500);

   }

   function checkTime(i) {

      if (i < 10) {i = "0" + i};  // add zero in front of numbers < 10

      return i;

   }

</script>        

 

HTML

<body onload="startTime()">

<div id="clockTxt"></div>

 

Disclaimer

Confidentiality: This e-mail and its attachments are intended for the above named only and may be confidential. If they have come to you in error you must take no action based on them, nor must you copy or show them to anyone; please reply to this e- mail and highlight the error. Security Warning: Please note that this e-mail has been created in the knowledge that Internet e-mail is not a 100% secure communications medium. We advise that you understand and observe this lack of security when e-mailing us. Viruses: Although we have taken steps to ensure that this e-mail and attachments are free from any virus, we advise that in keeping with good computing practice the recipient should ensure they are actually virus free.

No comments:

Post a Comment