Chrome: window.innerHeight is equal to window.outerHeight? Why?

1k Views Asked by At

I have JS which opens a new window using window.open. The size of the window is set in the windowFeatures string passed to the open function. here is how the string looks at run time.

width=650,
height=350,
toolbar=no,
directories=no,
status=no,
menubar=no,
scrollbars=yes,
resizable=yes,
modal=yes,
left=321,
top=209

You can see that the height is set to 350 here.

After the window.open call, the handle returned is used to resize the window again to a height of 350.

So basically we have

v_window = window.open(url, name, windowFeatures);
v_window.resizeTo(width, height);

Now, in the window that is opened, we have javascript that resizes the window. The window gets size from a metadata table and resizes itself. The resize computation uses window.outerHeight and window.innerHeight. But it looks like both of them return the same value of 350. Why is that so? Shouldn't the outerHeight be more than the innerHeight since the address bar and the window title is visible?

Also I've noticed that if the remove the resizeTo call in the parent window, the outerHeight and innerHeight values in the child window are correct. How does the resizeTo call change the behavior? Any leads?

1

There are 1 best solutions below

1
On

It doesn't really help, but I believe your analysis is correct: Chrome is currently buggy in this regard. I've documented things a bit in https://crbug.com/823588#c4 if you want to star that bug.