Further changes for the Use cases on the live site.
[yaffs-website] / node_modules / phantomjs-prebuilt / lib / phantom / examples / loadurlwithoutcss.js
1 "use strict";
2 var page = require('webpage').create(),
3     system = require('system');
4
5 if (system.args.length < 2) {
6     console.log('Usage: loadurlwithoutcss.js URL');
7     phantom.exit();
8 }
9
10 var address = system.args[1];
11
12 page.onResourceRequested = function(requestData, request) {
13     if ((/http:\/\/.+?\.css/gi).test(requestData['url']) || requestData.headers['Content-Type'] == 'text/css') {
14         console.log('The url of the request is matching. Aborting: ' + requestData['url']);
15         request.abort();
16     }
17 };
18
19 page.open(address, function(status) {
20     if (status === 'success') {
21         phantom.exit();
22     } else {
23         console.log('Unable to load the address!');
24         phantom.exit();
25     }
26 });