ThomasReggi
ThomasReggi

Reputation: 59525

How do I change the user agent?

I'm having trouble with phantom the node wrapper around phantomjs.

This is how you do it in native phantomjs.

page.settings.userAgent = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36';

Upvotes: 0

Views: 118

Answers (1)

Paul S.
Paul S.

Reputation: 66394

A quick search found a thread on GitHub about this, looks like the you need to use page.set, e.g.

page.set('settings.userAgent', 'new useragent');

or when choosing multiple settings,

page.set('settings', {
    userAgent: 'new useragent',
    javascriptEnabled: true,
    loadImages: true
});

Upvotes: 2

Related Questions