Alex Churchill
Alex Churchill

Reputation: 4957

Javascript -- Increase window height by one pixel -- Google Chrome

I'm working on a Chromium extension that runs a context script on a constrained window, and want to increase the window height by one pixel (I need the page to reposition, since I'm injecting HTML into it).

I'm attempting to use the following code:

window.resizeTo(window.innerWidth, window.innerHeight + 1);

but this shrinks the window (I suspect because Chromium resizeTo sets window size, but innerWidth and innerHeight gets the size of the TabContents window pane (not including the top bar and border).

How can I either get the proper size or properly resize the window? Thanks for any advice.

Upvotes: 0

Views: 1828

Answers (1)

John Green
John Green

Reputation: 13435

You actually want window.outerHeight/window.outerWidth, which includes all of the browser UI.

Upvotes: 4

Related Questions