phantom/bindings.js
function(status) {

      // Page is now opened
      pageInformation.isOpened = true;
      pageInformation.status = status;

      // Failing
      if (status !== 'success') {
        parent.replyTo(callId, wrapFailure('fail'));
        return cleanup();
      }

      // Wrong status code
      if (!pageInformation.response.status || pageInformation.response.status >= 400) {
        parent.replyTo(callId, wrapFailure('status'));
        return cleanup();
      }

      // Waiting for body to load
      page.evaluateAsync(function() {
        var interval = setInterval(function() {
          if (document.readyState === 'complete' || document.readyState === 'interactive') {
            clearInterval(interval);
            window.callPhantom({
              head: 'documentReady',
              body: true,
              passphrase: 'detoo'
            });
          }
        }, 30);
      });
    }
function(status) {

      // Page is now opened
      pageInformation.isOpened = true;
      pageInformation.status = status;

      // Failing
      if (status !== 'success') {
        parent.replyTo(callId, wrapFailure('fail'));
        return cleanup();
      }

      // Wrong status code
      if (!pageInformation.response.status || pageInformation.response.status >= 400) {
        parent.replyTo(callId, wrapFailure('status'));
        return cleanup();
      }

      // Waiting for body to load
      page.evaluateAsync(function() {
        var interval = setInterval(function() {
          if (document.readyState === 'complete' || document.readyState === 'interactive') {
            clearInterval(interval);
            window.callPhantom({
              head: 'documentReady',
              body: true,
              passphrase: 'detoo'
            });
          }
        }, 30);
      });
    }
function ( status ) { // Page is now opened pageInformation . isOpened = true ; pageInformation . status = status ; // Failing if ( status !== 'success' ) { parent . replyTo ( callId , wrapFailure ( 'fail' ) ) ; return cleanup ( ) ; } // Wrong status code if ( ! pageInformation . response . status || pageInformation . response . status >= 400 ) { parent . replyTo ( callId , wrapFailure ( 'status' ) ) ; return cleanup ( ) ; } // Waiting for body to load page . evaluateAsync ( function ( ) { var interval = setInterval ( function ( ) { if ( document . readyState === 'complete' || document . readyState === 'interactive' ) { clearInterval ( interval ) ; window . callPhantom ( { head : 'documentReady' , body : true , passphrase : 'detoo' } ) ; } } , 30 ) ; } ) ; }
When page load is finished
When page load is finished