Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
PoyangLiu opened this issue Mar 7, 2013 · 8 comments

Comments

@PoyangLiu
Copy link

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?

@tombigel
Copy link
Owner

tombigel commented Mar 7, 2013

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:
#34

@PoyangLiu
Copy link
Author

Yes, we saw this with a Wacom device.

@m-abs
Copy link

m-abs commented Mar 13, 2013

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).

@tombigel
Copy link
Owner

@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
Copy link
Owner

tombigel commented Apr 1, 2013

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

@rocker1976
Copy link

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?

@m-abs
Copy link

m-abs commented May 24, 2013

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.

@rocker1976
Copy link

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//issues/34#issuecomment-18420034
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants