BlueGit

blue-star danique-bot

Files

danique-bot / node_modules / phantomjs-prebuilt / lib / phantom / examples / useragent.js

useragent.js

Import template
timfa Tim · pushed by timfa · 4 years ago
c788ad20 History
useragent.js 498 B Download Raw
1"use strict";
2var page = require('webpage').create();
3console.log('The default user agent is ' + page.settings.userAgent);
4page.settings.userAgent = 'SpecialAgent';
5page.open('http://www.httpuseragent.org', function (status) {
6 if (status !== 'success') {
7 console.log('Unable to access network');
8 } else {
9 var ua = page.evaluate(function () {
10 return document.getElementById('myagent').innerText;
11 });
12 console.log(ua);
13 }
14 phantom.exit();
15});