user1305989
user1305989

Reputation: 3361

phantomjs - disable responsive nature (tried setting viewportsize to bigger value)

I am using phantomjs to generate screenshot of my website. It is responsive. When reduced size, the contents split and webpage appears like a narrow one. I cant disable this from css for now as resposive css is mixed badly with other js. So, I tried setting page.viewportSize = {'width': 1024, height: 768 }, but still it is generating screenshot as if website viewed from a device of small width.

 var page = require('webpage').create();
page.open('http://127.0.0.1', function () {
page.viewportsize = { width: 1024, height: 768 };
console.log(JSON.stringify(page.viewportsize));
page.render('local.png');

Reason for including tags: python is, they might have used this library.

Upvotes: 0

Views: 423

Answers (1)

ChrisP
ChrisP

Reputation: 5952

It would be good to see the page you are looking at. To start: set viewportsize before opening the page. What happens when you change the viewportsize before opening the page?

Upvotes: 1

Related Questions