fzaninotto / screenshot-as-a-service

Website screenshot service powered by node.js and phantomjs
1.1k stars 243 forks source link

Does not render background of this page #48

Open PhilAndrew opened 10 years ago

PhilAndrew commented 10 years ago

http://www.bbcgoodfood.com/recipes/beetroot-bacon-cheddar-bread-scrolls

jaydiablo commented 10 years ago

It looks like that site is responding with its mobile version to the phantom renderer, as you can see from the header of the page (even if the userAgent is forced to match my desktop Chrome browser):

screen shot 2013-12-24 at 10 57 22 am

I thought it might be the size of the viewport, but the background is present in 1024x768 on my desktop browser:

screen shot 2013-12-24 at 10 59 15 am

On my ipad, it renders similar to how phantom renders it (no seasonal background, mobile menu at the top).

screen shot 2013-12-24 at 11 11 29 am

I'm not certain if this is phantom's fault (not rendering the bg), or this site's fault (not serving the same html/css to phantom).

Regardless, I don't think this is really the screenshot service's responsibility, since phantomjs is primarily responsible for the rendering (assuming it's not the site's fault).

PhilAndrew commented 10 years ago

Hi Jay, so I turned off Javascript and it renders OK with Javascript turned off, so I guess its something in the javascript of this page which auto-detects (wrongly) that we are a mobile browser.

https://gist.github.com/PhilAndrew/8220147

PhilAndrew commented 10 years ago

It still bothers me, why it thinks its a mobile browser (wrongly), I wonder if its Modernizr library?

PhilAndrew commented 10 years ago

I'm a little bit obsessed as to why.

In the QupZilla browser it also shows in mobile format (incorrectly). http://www.qupzilla.com/

Clearly its not a bug of either PhantomJS or your code but I really wonder why.