You can get full screen with and height by this:
let screenWidth = screen.availWidth;
let screenheight = screen.availHeight;
And set your div width and height like this:
thisDiv.style.width = "200px";
Edit:
Sorry, maybe I didn't catch what do you want to do. Do you want to show divs randomly across the browser window?
Then using window.innerWidth
as you did, would be fine in first place, and you shouldn't change anything, but obviously something doesn't work fine.
But refer to question, do you want to resize the browser window? For this there is a method that could resize the window, but it works only if windows was opened by ``window.open(...```.
As I know, you can't resize the main browser or one Tab from javascript.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…