How can I set height, width and set the position of the current browser window in the document.ready()
function of jQuery ?
There supposed to be two javascript functions to resize and move the browser window:
window.resizeTo(width, height);
window.moveTo(x, y);
These functions are not supported by Chrome and Opera, and other browsers might experience certain security restrictions as well.
If you want to pop a new window with a certain size, check out the parameters of window.open()
. Your interface should also not rely on it entirely, for example you won't be able to do it on mobile browsers.
When thinking about if something is possible or not it's always a good start to think about ways to abuse it. Would you want windows on your screen to jump around every 100 milliseconds, just because some website wants to do that? Probably that's why it's unsupported or limited these days.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With