Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery resize and position current browser window

How can I set height, width and set the position of the current browser window in the document.ready() function of jQuery ?

like image 411
mmk_open Avatar asked Oct 11 '22 22:10

mmk_open


1 Answers

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.

like image 114
DarthJDG Avatar answered Oct 16 '22 14:10

DarthJDG