No way to determine native DPR of device
See original GitHub issueThe following code doesn’t allow someone to use the device’s native DPR by setting await page.setViewport({deviceScaleFactor: 0,...})
:
https://github.com/GoogleChrome/puppeteer/blob/master/lib/Page.js#L729 https://github.com/GoogleChrome/puppeteer/blob/294f33b75c5a7c87d447816218438f56c2d56f0e/lib/EmulationManager.js
That makes it impossible to determine the real DPR of the device:
await page.evaluate('window.devicePixelRatio');
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Window.devicePixelRatio - Web APIs | MDN
You can use window. matchMedia() to check if the value of devicePixelRatio changes (which can happen, for example, if the user drags the...
Read more >in iPhone App How to detect the screen resolution of the device
Now if you want to get the pixel width & height of the iOS device screen you just need to do one simple...
Read more >Chrome Developer Tools/Device mode doesn't emulate ...
(3) Open the Device mode (mobile/tablet 2nd icon in upper left corner of the Chrome Developer Tools panel/window). (4) In mobile emulator ...
Read more >rexxars/use-device-pixel-ratio: React hook for getting ... - GitHub
useDevicePixelRatio() is a React hook (and utility) that will tell you what the current device has as its Device Pixel Ratio (DPR).
Read more >device-pixel-ratio - npm search
A command line tool to measure responsive image efficiency across viewport sizes and device pixel ratios. responsive-images · img · zachleat. published 1.0.0...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You want to know this information for taking high quality screenshots.
For my particular case, I’m running an app in both mac and linux. So I want to use the correct DPR per the device without hard coding numbers.
Let’s introduce a
viewport
option to the launcher as a part of #1183. One of the values could benull
to disable viewport override altogether.