Can I Detect User’s Page Zoom Level on My Website?

0
0
Asked By SunnyDaze42 On

I'm trying to figure out if there's a way to detect the page zoom level that users set in their desktop browsers. For instance, if a user visits my website, sets the zoom to 75%, and then returns later, I'd like to automatically retrieve that zoom level (75%) so I can adjust my website's content accordingly. Is this feasible?

3 Answers

Answered By ChartMaster3000 On

I understand your intention, but detecting zoom levels can be tricky. I personally tried storing `devicePixelRatio` in `localStorage` during the user's first visit and then calculating the zoom level based on that. However, it fails in Safari since it doesn't update `devicePixelRatio` when zooming. You might want to look for a workaround for those browsers.

UserJourney -

Interesting method! I usually just focus on responsive design to avoid such issues. Have you noticed any improvement in how your charts display?

Answered By ResponsiveRandy On

You're heading for a lot of frustration with this feature! There are so many factors that change display settings based on the machine. It might be best to go for a responsive design instead.

Answered By TechieTina89 On

Unfortunately, it's not possible to directly retrieve the page zoom level in desktop browsers. They typically maintain the user's preferred zoom level, but there's no built-in way to access that data through JavaScript.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.