Y
Y
Yuri2014-06-27 09:33:20
JavaScript
Yuri, 2014-06-27 09:33:20

Is it possible to run JavaScript in the background in the phone's browser?

We have a banal script:

(function() {
  var $container = $('#container');

  $(function() {
    var digit = 0;
      setInterval(function() {
        digit += 3;
        $container.append(digit + "</br>");
      }, 3000);
   });
})();

If you run this script in the phone's browser (for example, iPhone) and put the phone into standby mode (by pressing the power button), the script will be stopped. After the phone is taken out of standby mode, the script will resume.
Question : Is it possible for a JS script to run in the background in the browser, as it happens in native applications?
( for example, applications that collect GPS coordinates by time interval )

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Melnikov, 2014-06-27
@Stmol

no, js background work is not possible, it makes sense to check the time from the start of the timer by interval and adjust the value.

S
Sergey, 2014-06-27
Protko @Fesor

Androids have the ability to create background services . There is a plugin
for iOS . So yes, it is possible, but it will also eat resources in the background.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question