macbre / phantomas

Headless Chromium-based web performance metrics collector and monitoring tool
https://www.npmjs.com/package/phantomas
BSD 2-Clause "Simplified" License
2.25k stars 141 forks source link

Struggeling width document with #556

Open matthiastosch opened 9 years ago

matthiastosch commented 9 years ago

Hi There,

i'm trying to detect if the tested url is a mobile site. One Metrik i try to use is document width is greater than the viewport width (in --phone mode) than i would like to store the metric isMobile = 0.

My Problem is: all js attributes for the document with are the same as the viewport size (400 in phone mode) document.body.scrollWidth document.documentElement.scrollWidth

when i try this in mobile emulator on chrome with the url www.mtosch.de i got the result 980. With phantomas i got alway 400. Is there a difference with the emulation?

Or do you know an other way to detect mobile Markup?

Thanks a lot for help Matthias

macbre commented 9 years ago

@matthiastosch, I assume you're using the latest version of phantomas. If so, please try running phantomas using PhantomJS 2.0 (--engine=webkit2).

matthiastosch commented 9 years ago

with --engine=webkit2 i got this error. phantomas http://www.mtosch.de/ --engine=webkit2 --verbose phantomas: (255) Engine crashed unexpectedly

i use mac os.

matthiastosch commented 8 years ago

i've run the the script with Debian & --engine=webkit2 and all values are 400. As described in my first post on top. is this a bug or does phantomas dosn't support this?

do you have an other idea to detect mobile friendly markup?

macbre commented 8 years ago

Well, phantomas is not responsible for running "browser" JavaScript - it's PhantomJS that gives you incorrect values.

You can give SlimerJS a try - --engine=gecko.