(FB Instant games) How I can get/set screen resolution?

自作多情 提交于 2020-01-04 07:54:18

问题


How can I get/set screen resolution for instant games in mobile facebook app or mesenger? I tried getting that by "window.screen.width" and "window.innerWidth", it returned me 360 pixels (but i have 980 in Chrome browser). I haven’t used any meta tags which can limit the resolution.


回答1:


You need to use window.innerWidth and window.innerHeight.

You need to multiply these by window.devicePixelRatio.

So:

PixelW = window.innerWidth *  window.devicePixelRatio;
PixelH = window.innerHeight *  window.devicePixelRatio;


来源:https://stackoverflow.com/questions/49034665/fb-instant-games-how-i-can-get-set-screen-resolution

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!