Reset browser zoom level when a page change

javascript, mobile

Solution

You can get the users zoom level by comparing the innerWidth and document width. Document width is the width of the device in pixels, inner width is the pixels which are on screen when zoomed (in relation to what the document width initially was). I have tested this on android (ICS and Jellybean), and iOS (5 and 6) and it seems to work. Note, I do not have my viewport set to device width or height

  ratio = document.width / window.innerWidth

  if ratio > 1 then zommed else notZoomed

Then you can do this check whenever a user makes a double tap or a pinch.

Problem

I have a mobile site that loads pages with ajax. One of the features I would like to add is to reset the zoom level when a page changes. Is there a good method to detect if a user zoomed the view while viewing a page? Until now I've managed to do the check for pinch zoom. But sometimes there is double tap zooming too ..

Original source