I do not believe that there is a standard way to do this. Some browsers may offer their own API for this, but I doubt it.
Speaking of which, I have done this effect in the past with some CSS tricks. Essentially, your CSS defines each dimension (width, height, edge, padding, font size, etc.) in em instead of px. As a result, the size depends on the default font size for the document. Then, to zoom in, you change the font size of the body tag to make things smaller or larger. If you do this carefully, the effect will look the same as if the user zoomed in using their browser.
To make life easier with this, I like to use the CSS reset stylesheet, which sets 1em to 10px. Thus, if you want the div to be 200 pixels wide, you just set it to 20em. You can do this by setting the body font size to 62.5% in the CSS reset stylesheet. Since most browsers have a default font size of 16px and therefore 1em = 16px, 10px is 62.5%.
Hope this helps, working on it very well, but using em instead of px has helped me in countless ways when working with HTML and CSS.
macinjosh
source share