user1034774
user1034774

Reputation:

Can i resize Chrome window using the console?

Is it possible to resize the Chrome window using the developer tool's console? If so, what would the command be? becuase the window.resizeTo(w,h) didn't work for me.

Upvotes: 9

Views: 10934

Answers (4)

Richard
Richard

Reputation: 41260

On macOS you can run: open -a Google\ Chrome --args --window-size=1366,768

Upvotes: 1

Konrad Dzwinel
Konrad Dzwinel

Reputation: 37913

Official Chrome issue says:

By Design we don't support resize/move for tabs, only constrained windows.

Windows in Chrome can be resized via Chrome extensions API, however it's not available from console. You should probably try using one of many 'window resizing' extensions. In the near future it will be possible for extensions to add own console commands, however as for now it's an experimental feature.

Upvotes: 5

stefano
stefano

Reputation: 263

Since Firefox 7, it's no longer possible for a web site to change the default size of a window in a browser, according to the following rules:

  • You can't resize a window or tab that wasn’t created by window.open.
  • You can't resize a window or tab when it’s in a window with more than one tab.

found on https://developer.mozilla.org/en-US/docs/DOM/window.resizeTo#Notes

some try and error seems to prove that these rules also apply in Chrome.

Upvotes: 0

Akram Berkawy
Akram Berkawy

Reputation: 5060

i think you can only resize windows that's you have created from the console, like popups for example:

var pop=window.open("","","width=1024,height=768");
pop.resizeTo(100,100);

Upvotes: 2

Related Questions