Closed gbaudusseau closed 10 years ago
for example safari have the default width : 980 pixels
FWIW, in my code, I've adopted as default width 3 times the device-width (which for safari/ios gives 980)
as default device-width for iOS isn't 320px ?
For me, we have 3 differents width:
I think we have to set viewport page as mobile browser's viewport and if we found a meta-viewport we have to adjust it. e.g : if a website don't have any viewport it can be display without double scrolling (of course if width of document not larger than 980) but users have to zoom to read correctly. I don't see in your code where you are using 980px.
in
renderingData = {zoom: null, width: system.args[1]*3, height: system.args[2]*3};
in lib/phantom-script.js
(it ends up being 960 for a 320 default with, instead of 980 — I incorrectly remembered this as the default in Safari)
so I will change it for 960. I will add more profiles browsers like:
Android 1, 2 et 3 : 800px Android 4 : 980px Opera mini : 850px Opera mobile : 980px Internet Explorer mobile : 1024px
about @viewport in CSS http://media-queries.aliasdmc.fr/meta_viewport_et_viewport_css_mobile.php
So, it looks like there are a number of issues at stake here:
The two last points seem to point towards trying different headless browsers to see if we can overcome these phantomjs limitations with them, or if we need to start patching phantomjs to make it do what we need.
I saw the problem for sending screenshot as data. I tried fixed it but I failed. so ok for the moment I will revert this change.
I will going try other headless browser: at http://slimerjs.org/features.html I read: "The web page rendering in SlimerJS is strictly identical to the rendering in Firefox". it could be a good thing in media queries interpretation. but I also read "Contrary to PhantomJS, SlimerJS is not headless: you see windows and it needs a graphical environment. You can use a tool like xvfb on a Linux/MacOS system to have this headless feature and to execute SlimerJS on Linux boxes that do not have xorg installed."
So in this article (http://e-method.blogspot.fr/2010/11/google-chrome-with-xvfb-headless-server.html) I read we can run chrome in headless mode like slimerjs with xvfb.
and we have mephisto but I read screenshot functionality is unstable (date of 2011 maybe they improve it) http://blog.temesis.com/post/2011/03/22/Mephisto-un-navigateur-cote-serveur
what's the best as you think to start ?
I would probably try first headless Chromium on XVFB, since:
(note that running a full browser in XVFB is likely to be much more resources intensive than just running phantomjs; so that will be something to watch, and maybe to stress-test sooner rather than later)
ok i'm on it! :)
I suggest doing that work in a separate branch from master for now — we can keep the phantomjs solution in master for now, since it kind-of-works.
good article (in French) here: http://www.alsacreations.com/article/lire/1490-comprendre-le-viewport-dans-le-web-mobile.html
We don't have to set up just smartphone profile but also mobile browser profiles.