9

This is my code:

page.onResourceRequested = function (requestData, networkRequest) {
    console.log(requestData.url); // This message shows http://website-with-jquery-included.com/page.html!
}

page.onResourceError = function(resourceError) {
  console.log('Unable to load resource (#' + resourceError.id + 'URL:' + resourceError.url + ')');
  console.log('Error code: ' + resourceError.errorCode + '. Description: ' + resourceError.errorString);
};

page.open('http://website-with-jquery-included.com/', function(status) {
    if (status === "success") {

        page.evaluate(function() {

            console.log('I can see this message');

            $.ajax({url: 'http://website-with-jquery-included.com/page.html', success: function(resp) {
                console.log('I cannot see this message!');
            }});
        });
    }
});

Function page.onResourceError prints the error message:

Unable to load resource (#35URL:http://website-with-jquery-included.com/page.html)

Error code: 5. Description: Operation canceled

Why is it canceled? I didn't cancel anything manually. It works well from the browser (Google Chrome).

Serhii Matrunchyk
  • 6,275
  • 4
  • 31
  • 44

0 Answers0