Hello. I would like to be able to change the height of a child window depending on the size of what gets loaded to it, and re-use the same window again and again, changing its height each time as appropriate.
So far, I find that if I try the following:
function MyWin(url,h){
features=’screenX=320,screenY=60,left=320,top=30,resizable,height=’ + h + ‘,width=600,scrollbars’;
win=window.open(url,features,true);
win.focus();
}
Then whatever height the window opens with the first time is the height it opens with on subsequent function calls no matter what new height parm is passed.
If I try the following:
function MyWin(nm,url,h){
features=’screenX=320,screenY=60,left=320,top=30,resizable,height=’ + h + ‘,width=600,scrollbars’;
win=window.open(url,nm,features,true);
win.focus();
}
This solves the above problem (each new height parm value is now responded to correctly), but it creates a different problem: instead of re-using the same window again and again as I had intended, a separate window opens for each different name (nm) parm. This is not at all what I want since it simply clutters up the user’s desktop (or task bar), and requires him to perform the needless extra step of closing each window himself.
It does not seem to help to add if (!win.closed) win.close() at the top of the function. And the fourth ‘true’ value (for the parameter named ‘replace’) seems to make no difference either (not that I understand exactly what ‘replace’ means here).
Any ideas?
Thanks for your help!
Peyton