phantomas icon indicating copy to clipboard operation
phantomas copied to clipboard

Struggeling width document with

Open matthiastosch opened this issue 8 years ago • 4 comments

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

matthiastosch avatar Sep 23 '15 12:09 matthiastosch

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

macbre avatar Sep 23 '15 14:09 macbre

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 avatar Sep 23 '15 15:09 matthiastosch

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?

matthiastosch avatar Sep 25 '15 16:09 matthiastosch

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.

macbre avatar Sep 25 '15 18:09 macbre