1 var page = require('webpage').create(),
2 system = require('system'),
5 if (system.args.length === 1) {
6 console.log('Usage: netlog.js <some URL>');
9 address = system.args[1];
11 page.onResourceRequested = function (req) {
12 console.log('requested: ' + JSON.stringify(req, undefined, 4));
15 page.onResourceReceived = function (res) {
16 console.log('received: ' + JSON.stringify(res, undefined, 4));
19 page.open(address, function (status) {
20 if (status !== 'success') {
21 console.log('FAIL to load the address');