Reset browser zoom level on page change

I have a mobile site that loads pages using ajax. One of the features that I would like to add is to reset the zoom level when the page changes.

Is there a good method for determining if a user has enlarged an image while viewing a page?

So far, I have managed to check to increase the zoom. But sometimes there is also double scaling.

+3
source share
2 answers

You can increase the scalability of users by comparing the width of the interval and the width of the document. The width of the document is the width of the device in pixels, the internal width is the pixels that appear on the screen when enlarged (relative to what was originally the width of the document). I tested this on android (ICS and Jellybean) and iOS (5 and 6) and it seems to work. Please note: I do not have my viewport set to the width or height of the device

  ratio = document.width / window.innerWidth

  if ratio > 1 then zommed else notZoomed

You can then do this check every time the user double-clicks or a pinch.

+9
source

you can set the contents of the [meta name = "viewport"] tag using javascript to set the zoom level, unfortunately, I did not find a way to determine what the current zoom level is

0
source

All Articles