sfpx

FMGO 13 , webviewer crashes

Discussion created by sfpx on Aug 26, 2015
Latest reply on Oct 24, 2015 by sfpx

I have a web viewer with the following content

"data:text/html," & "<!DOCTYPE HTML>

<html>

    <head>

        <script type=\"text/javascript\">

       var Calls=0;

       var LastCall=0;

            function handler(location) {

                var messageArea = document.getElementById(\"messageArea\");

                messageArea.innerHTML=\"Calls:\"+Calls+\"<p>Latitude: \" + location.coords.latitude + \"</p>\";

                messageArea.innerHTML+=\"<p>Longitude: \" + location.coords.longitude + \"</p>\";

                messageArea.innerHTML+=\"<p>Accuracy: \" + location.coords.accuracy + \"</p>\";

                messageArea.innerHTML+=\"<p>Speed: \" + location.coords.speed+ \"</p>\";

                messageArea.innerHTML+=\"<p>T: \" + location.timestamp+ \"</p>\";

 

 

if (location.timestamp-LastCall>5000 || LastCall==0){

 

 

    Calls++;

    CallFM(location.coords.latitude,location.coords.longitude,location.coords.accuracy,location.coords.speed);

    LastCall=location.timestamp;

 

 

};

           

            }

 

 

         

            function fail() {

                var messageArea = document.getElementById(\"messageArea\");

                messageArea.innerHTML=\"<p>Can't get located</p>\";

 

 

            }

 

 

           function CallFM(latitude,longitude,accuracy,speed) {

var body = document.getElementsByTagName(\"body\")[0];

var a = document.createElement(\"a\");

a.href = \"FMP://~/MyApp.fmp12?&Script=UpdateCoords&$latitude=\"+latitude+\"&$longitude=\"+longitude+\"&$accuracy=\"+accuracy+\"&$speed=\"+speed;

 

 

a.style.display = \"none\";

body.appendChild(a);

a.click();

a.parentNode.removeChild(a)

}          

            function getLocation() {

 

 

              navigator.geolocation.watchPosition(handler,fail,{maximumAge: 2000, enableHighAccuracy: true, timeout: 2000});

            }

          

        </script>

    </head>

 

 

    <body onload=\"getLocation();\" bgcolor=black >

        <div id=\"messageArea\">

           

        </div>

    </body>

 

 

</html>

"

 

The updatecoords script  simply puts the parameter values into global variables that are displayed on the layout.

 

FmGo13 will crashes randomly...it may take 30 minutes , less or more.

 

I suspect a memory leak somewhere.

Any obvious reason why it would crash ?

 

P.S.

I know FMGo has a location function but the problem is that it's a "blocking" function and can't run in the background ..plus it does not have the speed which is useful for my app.

Outcomes