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