Last active
August 29, 2015 14:01
-
-
Save billjohnston/52fb6460747b06c96e8f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var phantom = require('node-phantom-simple'); | |
var user_agent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1944.0 Safari/537.36'; | |
var page = 'http://google.com' | |
phantom.create(function (phantom_err, ph) { | |
ph.createPage(function (page_err, page) { | |
page.open(page, function (open_err, status) { | |
page.evaluate(function(){ | |
return navigator.userAgent; | |
}, function(err, result){ | |
console.log(result); | |
ph.exit(); | |
}); | |
}); | |
}); | |
}); | |
phantom.create(function (phantom_err, ph) { | |
ph.createPage(function (page_err, page) { | |
page.set('settings', {userAgent: user_agent}, function(){ | |
page.open(page, function (open_err, status) { | |
page.evaluate(function(){ | |
return navigator.userAgent; | |
}, function(err, result){ | |
console.log(result); | |
ph.exit(); | |
}); | |
}); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment