detect-zoom icon indicating copy to clipboard operation
detect-zoom copied to clipboard

Invalid zoom in Chrome when touch/pen/tablet input devices is plugged into a desktop/laptop computer

Open PoyangLiu opened this issue 11 years ago • 8 comments

When the touch/pen/tablet input devices is plugged in and drivers installed, the detect-zoom.js interpret the current desktop computer as a mobile device because of the ontouchstart event. The _zoomWebkitMobile() is reported instead of _zoomWebkit().

When this happens, the zoom level is only correct when the browser is maximized with nothing obscuring the borders (such as the height or width of a windows taskbar).

Should I suggest that a better user agent sniffing code be used to detect 'mobile' devices?

PoyangLiu avatar Mar 07 '13 21:03 PoyangLiu

Which kind of device you are talking about? Will I see it with a Wacom device attached ? — Sent from Mailbox for iPhone

On Thu, Mar 7, 2013 at 11:11 PM, Jay [email protected] wrote:

When the touch/pen/tablet input devices is plugged in and drivers installed, the detect-zoom.js interpret the current desktop computer as a mobile device because of the ontouchstart event. The _zoomWebkitMobile() is reported instead of _zoomWebkit(). When this happens, the zoom level is only correct when the browser is maximized with nothing obscuring the borders (such as the height or width of a windows taskbar).

Should I suggest that a better user agent sniffing code be used to detect 'mobile' devices?

Reply to this email directly or view it on GitHub: https://github.com/tombigel/detect-zoom/issues/34

tombigel avatar Mar 07 '13 22:03 tombigel

Yes, we saw this with a Wacom device.

PoyangLiu avatar Mar 08 '13 00:03 PoyangLiu

Incorrect zoom-level detection for chrome on multiscreen setup

We're having a similar problem.

We're using detect-zoom v1.0.2 on http://www.heste-nettet.dk and we've encountered a bug with Chrome.

A laptop PC with the following setup returns a incorrect (too-low) zoom-level: Primary monitor is the built-in pointer-screen (like a touchscreen just with pointer) with a 1280x800 resolution. Secondary monitor is a normal screen with a 2048x1152 resolution.

The PC is running Windows 7.

Chrome is started from the primary screen but opens on the secondary screen and our site i the homepage. And just after load the zoom-level is detected to be 0.625 event though Chrome says it's at 100% and we need to zoom to ~175% because zoom-level is detected to be over 1.

I ran some debugging on the library and I can see that it detects that the “ontouchstart”-event exists and the function webkitMobile therefor is used to detect the zoom-level. Unfortunately that function uses window.screen to do it's calculation, in this case window.screen is the primary screen and not the secondary screen that the browser-window is actually on. And since the two screen have different resolutions, the calculation is wrong.

NOTE: It's important that it's the first page being opened, as switching page resolves the problem.

In our case we don't need detection on mobile devices so we've commented it out in our version, so the webkitMobile function isn't used anymore and we've added checks, so iPad/iPhone and Android browser don't use detect-zoom anymore (our warning doesn't make sense in those cases).

m-abs avatar Mar 13 '13 11:03 m-abs

@m-abs About the multiple screens - This requires tests that I'm not able to do right now.. I'm on a Mac with 2 screens but none of them is some form of "retina". Will revisit it when I'll be able to or when someone offers a fix

tombigel avatar Mar 29 '13 14:03 tombigel

@PoyangLiu I think I fixed it, please check version 1.0.4 and close the issue if things work for you

tombigel avatar Apr 01 '13 20:04 tombigel

Hello. Thanks for your help with detect-zoom :) I'm checking your detect-zoom.js in Chrome version 26 and works fine. In the current version 27 is not working. Could you please help with this?

rocker1976 avatar May 24 '13 17:05 rocker1976

Sorry I didn't get back to you. It looks like the newest version is detecting Chrome correctly on the laptop I described earlier.

@rocker1976 See #37 there is new webkit detection function that works on Chrome v27.

m-abs avatar May 24 '13 17:05 m-abs

Thanks :)

On Fri, May 24, 2013 at 1:53 PM, Morten Sjøgren [email protected]:

Sorry I didn't get back to you. It looks like the newest version is detecting Chrome correctly on the laptop I described earlier.

@rocker1976 https://github.com/rocker1976 See #37https://github.com/tombigel/detect-zoom/issues/37there is new webkit detection function that works on Chrome v27.

— Reply to this email directly or view it on GitHubhttps://github.com/tombigel/detect-zoom/issues/34#issuecomment-18420034 .

rocker1976 avatar May 24 '13 20:05 rocker1976