How to resize maximized child window programmatically

I want to launch my web application in maximized window (not full screen) application mode from command line.

This is my script to launch the app:

$flags = "--app=$applicationUrl --new-window --start-maximized"
(New-Object -ComObject WScript.shell).Run('chrome.exe ' + $flags)

My app launched in maximized window, application mode.

But the problem is, when I open a child window from my application, the child window is also in maximized size. Which I don’t want it.

I want the child window to be able to resize to a fixed height and width.

I have tried to use the window.resizeTo(1400, 1000) function to resize the child window, it is not working while child window is in maximized size.

If I click the restore down button on the child window to make it small first, for example 800,600. Then run the window.resizeTo(1400, 1000) it will work.

How can I achieve this?

Is there a way to mimic the restore down button behavior using JavaScript?