PDA

View Full Version : new window, set to max width/height?



Aidanx
05-16-2007, 12:29 PM
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=1032,height=746,left = 387,top = 259');");
}

Im using the above script on my website [visitors click button and it opens a window with my website on it]. Does anyone know how to set a standard so that the page resizes to fit their window to avoid any problems with different screen resolutions?

mwinter
05-16-2007, 09:55 PM
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=1032,height=746,left = 387,top = 259');");
}

Im using the above script on my website

Ick.

Assuming you don't need to reference the window in code (which that function makes rather difficult anyway, at least use:



function popUp(uri) {
window.open(uri, '_blank', 'scrollbars,resizable');
}




[visitors click button and it opens a window with my website on it].

That's the idea, but not necessarily the reality. You are aware that some visitors will indiscriminately disable pop-ups entirely, or those pop-ups will open as tabs ignoring your specified size and location.



Does anyone know how to set a standard so that the page resizes to fit their window to avoid any problems with different screen resolutions?

Ensure that the window is scrollable and resizeable, and don't specify any dimensions or position. Allow the window manager to do its job and create windows in a predictable or desirable manner. Better yet, don't create a new window at all, if you can help it.

Aidanx
05-17-2007, 07:06 AM
Thats just the script, the actual code was involving a form that being the twat I am, I managed to delete during a clean out but I can rewrite it.

And if I leave the height and width blank, then it doesnt even pop-up.