E
E
enovot2014-11-03 04:59:04
JavaScript
enovot, 2014-11-03 04:59:04

phonegap. Why don't the loadstart, loadstop, etc. events fire?

Good day.
I need the application to open a new page and trigger the 'loadstop' event in it. But I can't. Method

window.open('http://apache.org', '_blank', 'location=yes');

fires, but the "loadstart" and "loadstop" events do not fire. Why can this be?
I ran this example
<!DOCTYPE html>
<html>
  <head>
    <title>InAppBrowser.addEventListener Example</title>

    <script type="text/javascript" charset="utf-8" src="cordova-2.6.0.js"></script>
    <script type="text/javascript" charset="utf-8">

    // Wait for Cordova to load
    //
    document.addEventListener("deviceready", onDeviceReady, false);

    // Cordova is ready
    //
    function onDeviceReady() {
         var ref = window.open('http://apache.org', '_blank', 'location=yes');
         ref.addEventListener('loadstart', function(event) { alert('start: ' + event.url); });
         ref.addEventListener('loadstop', function(event) { alert('stop: ' + event.url); });
         ref.addEventListener('loaderror', function(event) { alert('error: ' + event.message); });
         ref.addEventListener('exit', function(event) { alert(event.type); });
    }

    </script>
  </head>
  <body>
  </body>
</html>

from this site

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2014-11-03
@aspetek

It may not work in a browser. For example, for debugging, I had to replace loadstop with load.
Try to test on an emulator or device.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question