node-phantom icon indicating copy to clipboard operation
node-phantom copied to clipboard

Add support for userAgent

Open Osmosis311 opened this issue 11 years ago • 1 comments

https://github.com/ariya/phantomjs/blob/master/examples/useragent.js

Osmosis311 avatar Dec 12 '13 15:12 Osmosis311

Vote up! For now one could use this hack:

function setUserAgent(page, ua) {
    page.setFn('EVIL_EVAL', 'page.settings.userAgent = "' + ua + '"');
}

I think API should be more broad to support setting of nested page properties like

page.set('settings.userAgent', ua);

but not only userAgent or any of page.settings

AlexanderYastrebov avatar Dec 19 '13 14:12 AlexanderYastrebov