New Internet Explorer windows do not respect reset zoom level when using script

Symptoms

Consider the following scenario. You use Windows Internet Explorer 8 or Windows Internet Explorer 9 to browse to a page that has a zoom level other than 100%. This page contains a button that opens a new window with specific dimensions using script. You have the Reset zoom level for new windows and tabs option set under the Advanced tab of Internet Explorer Internet Options. When you click the button, the new window opens with the same zoom level as the parent window. This can cause some unexpected behavior on the child window where portions of the child window are not visible.

On Internet Explorer versions prior to Internet Explorer 8, the new window opens with a zoom level equal to 100%

Cause

In Internet Explorer 8 and above, windows created using the window.open API (as well as showMod[al:eless]Dialog and createPopup) have been designed to not honor the Reset zoom level for new windows and tabs setting and always inherit the zoom factor from their parent page. 

Resolution

The new window dimensions and the dimensions of the objects it contains can be scaled according to the zoom level that it inherits. The pertinent formulas are:

1. The actual zoom level can be calculated as:


var zoomLevel = window.screen.deviceXDPI / window.screen.logicalXDPI;


2. To counterscale an element, the formula is:


var objectWidth = desiredUnscaledWidth / zoomLevel;var objectWidth = desiredUnscaledWidth / zoomLevel;

Properties

Article ID: 2741211 - Last Review: Aug 9, 2012 - Revision: 1

Windows Internet Explorer 8, Windows Internet Explorer 9

Feedback