Skip to content

Instantly share code, notes, and snippets.

View thorsten's full-sized avatar
:octocat:
I love it when a plan comes together.

Thorsten Rinne thorsten

:octocat:
I love it when a plan comes together.
View GitHub Profile
@thorsten
thorsten / setUserAgent.js
Created May 9, 2016 15:12
Override user agent on all browsers
function setUserAgent(window, userAgent) {
// Works on Firefox, Chrome, Opera and IE9+
if (navigator.__defineGetter__) {
navigator.__defineGetter__('userAgent', function () {
return userAgent;
});
} else if (Object.defineProperty) {
Object.defineProperty(navigator, 'userAgent', {
get: function () {
return userAgent;
console.log('Loading a web page');
var page = require('webpage').create();
page.open('http://www.billigflieger.de/', function(status) {
page.render('billigflieger.png');
console.log(status);
phantom.exit();
});